library(tidyverse, quietly = T)
library(readxl)
library(gt)
library(kableExtra)
library(janitor)
library(pdftools)
library(plotly)

Data

ASHA-PAC’s Spending

These data were obtained from OpenSecrets.org. Specifically data from ASHA-PAC’s spending on 2020 House and Senate candidates and 2022 House and Senate candidates.

Click here to see ASHA-PAC’s Summary on OpenSecrets.org

Click here to learn about ASHA-PAC and view their Frequently Asked Questions page.

Click here to see ASHA-PAC’s current considerations when deciding who to donate to.

2022

House

asha_2022_rep <- read.csv("/Users/brett/Documents/R/PoliticalSpreadsheet/ASHA_PAC/ASHA_2022_candidateSpending_house.csv")

asha_2022_rep %>% separate(Candidate, 
                           into = c("Name", "ID"), 
                           sep = "\\(",
                           remove = F) %>%
  separate(ID,
           into = c("Party", "State"),
           sep = "\\-") -> asha_2022_rep

#Clean up state labels

asha_2022_rep %>%
  mutate(State = case_when(
    State == "Fla)" ~ "FL",
    State == "WVa)" ~ "WV",
    State == "Mass)" ~ "MA",
    State == "NJ)" ~ "NJ",
    State == "Calif)" ~ "CA",
    State == "Texas)" ~ "TX",
    State == "Ky)" ~ "KY",
    State == "Wash)" ~ "WA",
    State == "NC)" ~ "NC",
    State == "Wis)" ~ "WI",
    State == "Ill)" ~ "IL",
    State == "Va)" ~ "VA",
    State == "Pa)" ~ "PA",
    State == "NY)" ~ "NY",
    State == "Del)" ~ "DE",
    State == "Conn)" ~ "CT",
    State == "Ore)" ~ "OR",
    State == "Mich)" ~ "MI",
    State == "Vt)" ~ "VT",
    State == "Ohio)" ~ "OH",
    State == "Colo)" ~ "CO",
    State == "Md)" ~ "MD",
    State == "SC)" ~ "SC",
    State == "LA)" ~ "LA",
    State == "La)" ~ "LA",
    State == "Minn)" ~ "MN",
    State == "Okla)" ~ "OK",
    State == "Mo)" ~ "MO",
    State == "Nev)" ~ "NV",
    State == "Iowa)" ~ "IA",
    State == "Ga)" ~ "GA",
    State == "Ark)" ~ "AR",
    State == "NH)" ~ "NH",
    State == "Ariz)" ~ "AZ",
    State == "Ala)" ~ "AL",
    State == "Neb)" ~ "NE",
    State == "Maine)" ~ "ME",
    State == "Miss)" ~ "MS",
    State == "NM)" ~ "NM",
    State == "Ind)" ~ "IN",
    State == "ND)" ~ "ND",
    State == "Wyo)" ~ "WY",
    State == "Utah)" ~ "UT",
    
    TRUE ~ State
  )) -> asha_2022_rep

asha_2022_rep <- asha_2022_rep %>% clean_names()

asha_2022_rep$name <- str_squish(asha_2022_rep$name)

#convert total column to numeric
asha_2022_rep$total <- as.numeric(gsub("\\$", "", asha_2022_rep$total))
paste("In the 2022 election cycle, ASHA-PAC donated a total of $", sum(asha_2022_rep$total), "to Representatives' campaigns.")
## [1] "In the 2022 election cycle, ASHA-PAC donated a total of $ 126500 to Representatives' campaigns."

A list of Representatives ASHA-PAC donated money to for their 2022 campaign

asha_2022_rep %>% 
  select(-candidate) %>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name party state total
Frank Pallone Jr. D NJ 10000
Cathy McMorris Rodgers R WA 10000
Gus Bilirakis R FL 5000
Rodney Davis R IL 5000
David McKinley R WV 5000
Nancy Pelosi D CA 5000
Mikie Sherrill D NJ 5000
Mike Thompson D CA 5000
Brett Guthrie R KY 4500
Anna Eshoo D CA 4000
Suzanne Bonamici D OR 3500
Joseph Neguse D CO 3500
Lisa Blunt Rochester D DE 3500
Bill Johnson R OH 3000
Cindy Axne D IA 2500
Larry Bucshon R IN 2500
G K Butterfield D NC 2500
Angie Craig D MN 2500
Josh Harder D CA 2500
Doris Matsui D CA 2500
Lauren A Underwood D IL 2500
Alma Adams D NC 1000
Pete Aguilar D CA 1000
Kelly Armstrong R ND 1000
Troy Balderson R OH 1000
Karen Bass D CA 1000
Jaime Herrera Beutler R WA 1000
Earl Blumenauer D OR 1000
Brendan Boyle D PA 1000
Michael Burgess R TX 1000
Liz Cheney R WY 1000
Yvette Clarke D NY 1000
Tom Cole R OK 1000
Joe Courtney D CT 1000
John Curtis R UT 1000
Diana DeGette D CO 1000
Suzan DelBene D WA 1000
Mark Desaulnier D CA 1000
Debbie Dingell D MI 1000
Drew Ferguson R GA 1000
Jimmy Gomez D CA 1000
Kevin Hern R OK 1000
David P Joyce R OH 1000
Robin Kelly D IL 1000
Dan Kildee D MI 1000
Derek Kilmer D WA 1000
Ann Kuster D NH 1000
Darin LaHood R IL 1000
Bob Latta R OH 1000
Lucy McBath D GA 1000
Chris Pappas D NH 1000
Mark Pocan D WI 1000
Jan Schakowsky D IL 1000
Bobby Scott D VA 1000
Terri Sewell D AL 1000
Adrian Smith R NE 1000
Pete Stauber R MN 1000
Tim Walberg R MI 1000
Kevin Brady R TX 0

Senate

asha_2022_sen <- read.csv("/Users/brett/Documents/R/PoliticalSpreadsheet/ASHA_PAC/ASHA_2022_candidateSpending_senate.csv")

asha_2022_sen %>% separate(Candidate, 
                           into = c("Name", "ID"), 
                           sep = "\\(",
                           remove = F) %>%
  separate(ID,
           into = c("Party", "State"),
           sep = "\\-") -> asha_2022_sen

asha_2022_sen %>%
  mutate(State = case_when(
    State == "Fla)" ~ "FL",
    State == "WVa)" ~ "WV",
    State == "Mass)" ~ "MA",
    State == "NJ)" ~ "NJ",
    State == "Calif)" ~ "CA",
    State == "Texas)" ~ "TX",
    State == "Ky)" ~ "KY",
    State == "Wash)" ~ "WA",
    State == "NC)" ~ "NC",
    State == "Wis)" ~ "WI",
    State == "Ill)" ~ "IL",
    State == "Va)" ~ "VA",
    State == "Pa)" ~ "PA",
    State == "NY)" ~ "NY",
    State == "Del)" ~ "DE",
    State == "Conn)" ~ "CT",
    State == "Ore)" ~ "OR",
    State == "Mich)" ~ "MI",
    State == "Vt)" ~ "VT",
    State == "Ohio)" ~ "OH",
    State == "Colo)" ~ "CO",
    State == "Md)" ~ "MD",
    State == "SC)" ~ "SC",
    State == "LA)" ~ "LA",
    State == "La)" ~ "LA",
    State == "Minn)" ~ "MN",
    State == "Okla)" ~ "OK",
    State == "Mo)" ~ "MO",
    State == "Nev)" ~ "NV",
    State == "Iowa)" ~ "IA",
    State == "Ga)" ~ "GA",
    State == "Ark)" ~ "AR",
    State == "NH)" ~ "NH",
    State == "Ariz)" ~ "AZ",
    State == "Ala)" ~ "AL",
    State == "Neb)" ~ "NE",
    State == "Maine)" ~ "ME",
    State == "Miss)" ~ "MS",
    State == "NM)" ~ "NM",
    State == "Ind)" ~ "IN",
    State == "ND)" ~ "ND",
    State == "Wyo)" ~ "WY",
    State == "Utah)" ~ "UT",
    State == "Alaska)" ~ "AK",
    State == "SD)" ~ "SD",
    
    TRUE ~ State
  )) -> asha_2022_sen

asha_2022_sen <- asha_2022_sen %>% 
  clean_names()

asha_2022_sen$name <- str_squish(asha_2022_sen$name)

#convert total column to numeric
asha_2022_sen$total <- as.numeric(gsub("\\$", "", asha_2022_sen$total))
paste("In the 2022 election cycle, ASHA-PAC donated a total of $", sum(asha_2022_sen$total), "to Senators' campaigns.")
## [1] "In the 2022 election cycle, ASHA-PAC donated a total of $ 43000 to Senators' campaigns."

A list of Senators that ASHA-PAC donated money to for their 2022 campaign

asha_2022_sen %>% 
  select(-candidate) %>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name party state total
Patty Murray D WA 6000
Maggie Hassan D NH 5000
Ron Wyden D OR 5000
Lisa Murkowski R AK 4000
Bob Casey D PA 2500
Chuck Grassley R IA 2500
Markwayne Mullin R OK 2500
Charles E Schumer D NY 2500
Tina Smith D MN 2500
John Thune R SD 2500
Susan Collins R ME 2000
Todd Young R IN 2000
John A Barrasso R WY 1000
Sherrod Brown D OH 1000
Cindy Hyde-Smith R MS 1000
Debbie Stabenow D MI 1000

2020

House

asha_2020_rep <- read.csv("/Users/brett/Documents/R/PoliticalSpreadsheet/ASHA_PAC/ASHA_2020_candidateSpending_house.csv")

asha_2020_rep %>% separate(Candidate, 
                           into = c("Name", "ID"), 
                           sep = "\\(",
                           remove = F) %>%
  separate(ID,
           into = c("Party", "State"),
           sep = "\\-") -> asha_2020_rep

#clean up labels for states

asha_2020_rep %>%
  mutate(State = case_when(
    State == "Fla)" ~ "FL",
    State == "WVa)" ~ "WV",
    State == "Mass)" ~ "MA",
    State == "NJ)" ~ "NJ",
    State == "Calif)" ~ "CA",
    State == "Texas)" ~ "TX",
    State == "Ky)" ~ "KY",
    State == "Wash)" ~ "WA",
    State == "NC)" ~ "NC",
    State == "Wis)" ~ "WI",
    State == "Ill)" ~ "IL",
    State == "Va)" ~ "VA",
    State == "Pa)" ~ "PA",
    State == "NY)" ~ "NY",
    State == "Del)" ~ "DE",
    State == "Conn)" ~ "CT",
    State == "Ore)" ~ "OR",
    State == "Mich)" ~ "MI",
    State == "Vt)" ~ "VT",
    State == "Ohio)" ~ "OH",
    State == "Colo)" ~ "CO",
    State == "Md)" ~ "MD",
    State == "SC)" ~ "SC",
    State == "LA)" ~ "LA",
    State == "Minn)" ~ "MN",
    State == "Okla)" ~ "OK",
    State == "Mo)" ~ "MO",
    State == "Nev)" ~ "NV",
    State == "Iowa)" ~ "IA",
    State == "Ga)" ~ "GA",
    State == "Ark)" ~ "AR",
    State == "NH)" ~ "NH",
    State == "Ariz)" ~ "AZ",
    State == "Ala)" ~ "AL",
    State == "Neb)" ~ "NE"
  )) -> asha_2020_rep

#unique(asha_2020_rep$State)

asha_2020_rep <- asha_2020_rep %>% clean_names()

asha_2020_rep$name <- str_squish(asha_2020_rep$name)

#convert total column to numeric
asha_2020_rep$total <- as.numeric(gsub("\\$", "", asha_2020_rep$total))
paste("In the 2020 election cycle, ASHA-PAC donated a total of $", sum(asha_2020_rep$total), "to Representatives' campaigns.")
## [1] "In the 2020 election cycle, ASHA-PAC donated a total of $ 265500 to Representatives' campaigns."

A list of Representatives ASHA-PAC donated money to for their 2020 campaign

asha_2020_rep %>% 
  select(-candidate) %>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name party state total
Gus Bilirakis R FL 10000
David McKinley R WV 10000
Richard E Neal D MA 10000
Frank Pallone Jr. D NJ 10000
Mike Thompson D CA 10000
Kevin Brady R TX 7500
Brett Guthrie R KY 6000
Cathy McMorris Rodgers R WA 6000
Lloyd Doggett D TX 5000
Anna Eshoo D CA 5000
Virginia Foxx R NC 5000
Ron Kind D WI 5000
Doris Matsui D CA 5000
Nancy Pelosi D CA 5000
Bobby L Rush D IL 5000
Bobby Scott D VA 5000
Glenn Thompson R PA 5000
Paul Tonko D NY 5000
Lisa Blunt Rochester D DE 4500
Rosa DeLauro D CT 4000
Donna Shalala D FL 4000
Suzanne Bonamici D OR 3500
Lauren A Underwood D IL 3500
Tim Walberg R MI 3500
Peter Welch D VT 3500
Bill Johnson R OH 3000
Earl Blumenauer D OR 2500
Michael Burgess R TX 2500
G K Butterfield D NC 2500
Diana DeGette D CO 2500
Debbie Dingell D MI 2500
Steny H Hoyer D MD 2500
Robin Kelly D IL 2500
Nita M Lowey D NY 2500
Kevin McCarthy R CA 2500
Tom Rice R SC 2500
Steve Scalise R NA 2500
Elise Stefanik R NY 2500
Fred Upton R MI 2500
Greg Walden R OR 2500
Cheri Bustos D IL 2000
Angie Craig D MN 2000
Rodney Davis R IL 2000
Kendra Horn D OK 2000
David P Joyce R OH 2000
John Larson D CT 2000
Jan Schakowsky D IL 2000
Kurt Schrader D OR 2000
Jason Smith R MO 2000
Steven Horsford D NV 1500
Alma Adams D NC 1000
Cindy Axne D IA 1000
Troy Balderson R OH 1000
Nanette Barragan D CA 1000
Karen Bass D CA 1000
Jaime Herrera Beutler R WA 1000
Brendan Boyle D PA 1000
Anthony Brindisi D NY 1000
Vernon Buchanan R FL 1000
Tony Cardenas D CA 1000
Buddy Carter R GA 1000
Matt Cartwright D PA 1000
Kathy Castor D FL 1000
Judy Chu D CA 1000
Katherine Clark D MA 1000
Yvette D Clarke D NY 1000
James E Clyburn D SC 1000
Tom Cole R OK 1000
Joe Courtney D CT 1000
Danny K Davis D IL 1000
Suzan DelBene D WA 1000
Mark Desaulnier D CA 1000
Mike Doyle D PA 1000
Dwight Evans D PA 1000
Drew Ferguson R GA 1000
Brian Fitzpatrick R PA 1000
Jimmy Gomez D CA 1000
Josh Harder D CA 1000
Jahana Hayes D CT 1000
Brian Higgins D NY 1000
French Hill R AR 1000
George Holding R NC 1000
Jared Huffman D CA 1000
Hakeem Jeffries D NY 1000
Mike Kelly R PA 1000
Dan Kildee D MI 1000
Derek Kilmer D WA 1000
Ann Kuster D NH 1000
Darin LaHood R IL 1000
Bob Latta R OH 1000
John Lewis D GA 1000
Billy Long R MO 1000
Lucy McBath D GA 1000
Donald McEachin D VA 1000
Joseph Neguse D CO 1000
Tom O’Halleran D AZ 1000
Pete Olson R TX 1000
Jimmy Panetta D CA 1000
Chris Pappas D NH 1000
Bill Pascrell Jr. D NJ 1000
Mark Pocan D WI 1000
Tom Reed R NY 1000
Lucille Roybal-Allard D CA 1000
Raul Ruiz D CA 1000
Linda Sanchez D CA 1000
Brad Schneider D IL 1000
Kim Schrier D WA 1000
Terri A Sewell D AL 1000
Adrian Smith R NE 1000
Pete Stauber R MN 1000
Steve Stivers R OH 1000
Tom Suozzi D NY 1000
# asha_2020_rep %>%  #not a fan of the condensed form
#   select(-candidate) %>%
#   kbl(table.attr = "style = \"color: black;\"") %>%
#   kable_styling(bootstrap_options = c("striped", "hover"), position = "left",
#                 full_width = F) %>%
#   scroll_box(height = "400px")

# datatable(asha_2020_rep, #playing around with different table options
#           rownames = F,
#           height = "400px",
#           class = "display",
#           extensions = c("Responsive"))

Senate

asha_2020_sen <- read.csv("/Users/brett/Documents/R/PoliticalSpreadsheet/ASHA_PAC/ASHA_2020_candidateSpending_senate.csv")



asha_2020_sen %>% separate(Candidate, 
                           into = c("Name", "ID"), 
                           sep = "\\(",
                           remove = F) %>%
  separate(ID,
           into = c("Party", "State"),
           sep = "\\-") -> asha_2020_sen

#clean up state labels

asha_2020_sen %>%
  mutate(State = case_when(
    State == "Fla)" ~ "FL",
    State == "WVa)" ~ "WV",
    State == "Mass)" ~ "MA",
    State == "NJ)" ~ "NJ",
    State == "Calif)" ~ "CA",
    State == "Texas)" ~ "TX",
    State == "Ky)" ~ "KY",
    State == "Wash)" ~ "WA",
    State == "NC)" ~ "NC",
    State == "Wis)" ~ "WI",
    State == "Ill)" ~ "IL",
    State == "Va)" ~ "VA",
    State == "Pa)" ~ "PA",
    State == "NY)" ~ "NY",
    State == "Del)" ~ "DE",
    State == "Conn)" ~ "CT",
    State == "Ore)" ~ "OR",
    State == "Mich)" ~ "MI",
    State == "Vt)" ~ "VT",
    State == "Ohio)" ~ "OH",
    State == "Colo)" ~ "CO",
    State == "Md)" ~ "MD",
    State == "SC)" ~ "SC",
    State == "LA)" ~ "LA",
    State == "La)" ~ "LA",
    State == "Minn)" ~ "MN",
    State == "Okla)" ~ "OK",
    State == "Mo)" ~ "MO",
    State == "Nev)" ~ "NV",
    State == "Iowa)" ~ "IA",
    State == "Ga)" ~ "GA",
    State == "Ark)" ~ "AR",
    State == "NH)" ~ "NH",
    State == "Ariz)" ~ "AZ",
    State == "Ala)" ~ "AL",
    State == "Neb)" ~ "NE",
    State == "Maine)" ~ "ME",
    State == "Miss)" ~ "MS",
    State == "NM)" ~ "NM",
    
    TRUE ~ State
  )) -> asha_2020_sen

# unique(asha_2020_sen$State)

asha_2020_sen <- asha_2020_sen %>% clean_names()

asha_2020_sen$name <- str_squish(asha_2020_sen$name)

#convert total column to numeric
asha_2020_sen$total <- as.numeric(gsub("\\$", "", asha_2020_sen$total))
paste("In the 2020 election cycle, ASHA-PAC donated a total of $", sum(asha_2020_sen$total), "to Senators' campaigns.")
## [1] "In the 2020 election cycle, ASHA-PAC donated a total of $ 27500 to Senators' campaigns."

A list of Senators that ASHA-PAC donated money to for their 2020 campaign.

asha_2020_sen %>% 
  select(-candidate) %>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name party state total
Bill Cassidy R LA 5000
Susan Collins R ME 3500
Jeanne Shaheen D NH 3500
Dick Durbin D IL 2500
Cindy Hyde-Smith R MS 2500
Ben Ray Lujan D NM 2500
Mark Warner D VA 2500
Jeff Merkley D OR 2000
Shelley Moore Capito R WV 1500
Joe Kennedy III D MA 1000
Tina Smith D MN 1000
#Change names across DFs so they match
#anti_join(asha_2022_sen, senators, by = "name")

asha_2022_sen <- asha_2022_sen %>%
  mutate(name = case_when(
    name == "Charles E Schumer" ~ "Chuck Schumer",
    name == "John A Barrasso" ~ "John Barrasso",
    TRUE ~ name
  )) %>%
  rename(ASHA_PAC_total = total) %>%
  mutate(year = 2022,
         role = "Senator")

#rename total to ASHA_PAC_total, add role (senator/rep) and year for a single DF

asha_2022_rep <- asha_2022_rep %>% 
  rename(ASHA_PAC_total = total) %>%
  mutate(year = 2022,
         role = "Representative")

asha_2020_rep <- asha_2020_rep %>% 
  rename(ASHA_PAC_total = total) %>%
    mutate(year = 2020,
         role = "Representative")

asha_2020_sen <- asha_2020_sen %>% 
  rename(ASHA_PAC_total = total) %>%
    mutate(year = 2020,
         role = "Senator")

#combine information into a single DF

ashaPAC <- bind_rows(asha_2022_rep, asha_2022_sen, asha_2020_rep, asha_2020_sen)

ashaPAC$name <- str_squish(ashaPAC$name) #get rid of extra spaces

At a Glance FINALIZE

ashaPAC %>%
  select(-candidate) %>%
  filter(year == "2020") %>%
  group_by(year, party) %>%
  summarise(total_given = sum(ASHA_PAC_total))
## # A tibble: 2 × 3
## # Groups:   year [1]
##    year party total_given
##   <dbl> <chr>       <dbl>
## 1  2020 D          183000
## 2  2020 R          110000
ashaPAC %>%
  select(-candidate) %>%
  filter(year == "2022") %>%
  group_by(year, party) %>%
  summarise(total_given = sum(ASHA_PAC_total))
## # A tibble: 2 × 3
## # Groups:   year [1]
##    year party total_given
##   <dbl> <chr>       <dbl>
## 1  2022 D          102000
## 2  2022 R           67500

$169,500 to campaigns in 2022.

ashaPAC %>%
  select(-candidate) %>%
  group_by(year, party, role) %>%
  summarise(total_given = sum(ASHA_PAC_total)) %>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
year party role total_given
2020 D Representative 168000
2020 D Senator 15000
2020 R Representative 97500
2020 R Senator 12500
2022 D Representative 76500
2022 D Senator 25500
2022 R Representative 50000
2022 R Senator 17500
#can probably make a prettier table w/ gt() but not urgent

# ashaPAC %>%
#   select(-candidate) %>%
#   group_by(year, party, role) %>%
#   summarise(total_given = sum(ASHA_PAC_total)) %>%
#   gt() 

HRC Scorecard

Data from HRC’s Scorecard on the 117th, 116th, and 115th Congress are available here.

Code used to scrape data

#Insert file path to the PDF
hrc <- pdf_text("/Users/brett/Documents/R/PoliticalSpreadsheet/ASHA_PAC/117th-Congressional-Scorecard_web.cleaned.pdf")
###############################################################
############################ Senate ###########################
###############################################################


################# Page 8 

#Separate information into separate columns
#there are 20 votes taken into account

#hrc[8] 

senators1 <- hrc[8] #extract page from PDF document

senators1 <- strsplit(senators1, "\n") #Separate strings by new lines

senators1 <- senators1[[1]] #Only extract information we want

#senators1

senators1 <- str_squish(senators1) #remove all excess white space

#senators1

#new easier method
senators1 <- as.data.frame(senators1) #transform into DF

senators1 %>% filter(str_detect(senators1, "\\)")) -> senators1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#senators1[1,]

#one row is retained that is not needed - remove
senators1 <- senators1 %>% filter(senators1 != "SENATOR (Party) SCORE SCORE SCORE A B C D E F G H I J K L M N O P Q R S T")

senators1 %>% separate(senators1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> senators1

#separate votes into different categories
senators1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                        "vote_tuberville",
                                        "vote_johnLewis",
                                        "vote_filibuster",
                                        "vote_womensHealth",
                                        "vote_saferCommunities",
                                        "vote_lee",
                                        "vote_respectForMarriage",
                                        "vote_buttigieg",
                                        "vote_levine",
                                        "vote_jackson",
                                        "vote_robinson",
                                        "vote_nathan",
                                        "vote_impeachment",
                                        "vote_equalityAct",
                                        "vote_DNHA",
                                        "vote_TFPA",
                                        "vote_SSIA",
                                        "vote_IHRDA",
                                        "vote_ECDFA",
                                        "vote_PrEP"), 
                 sep = " ") -> senators1

senators1 <- senators1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

############ Page 9 w/ newer method

#hrc[9]

senators2 <- hrc[9]

senators2 <- strsplit(senators2, "\n")

senators2 <- senators2[[1]]

#senators2

senators2 <- str_squish(senators2)

#senators2

#new easier method
senators2 <- as.data.frame(senators2)
#filter out rows that do not contain ) 
senators2 %>% filter(str_detect(senators2, "\\)")) -> senators2

#senators2 <- senators2[-1,]
#Filter out first row
senators2 <- senators2 %>% 
  filter(senators2 != "SENATOR (Party) SCORE SCORE SCORE A B C D E F G H I J K L M N O P Q R S T")


senators2 %>% separate(senators2, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> senators2

senators2 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                        "vote_tuberville",
                                        "vote_johnLewis",
                                        "vote_filibuster",
                                        "vote_womensHealth",
                                        "vote_saferCommunities",
                                        "vote_lee",
                                        "vote_respectForMarriage",
                                        "vote_buttigieg",
                                        "vote_levine",
                                        "vote_jackson",
                                        "vote_robinson",
                                        "vote_nathan",
                                        "vote_impeachment",
                                        "vote_equalityAct",
                                        "vote_DNHA",
                                        "vote_TFPA",
                                        "vote_SSIA",
                                        "vote_IHRDA",
                                        "vote_ECDFA",
                                        "vote_PrEP"), 
                 sep = " ") -> senators2

senators2 <- senators2 %>% select(-score1) %>%
  rename(score1 = score2, score2 = score3, score3 = score4) %>%
  select(-votes)


hrc_sen <- bind_rows(senators1, senators2) 

################ Page 10

#hrc[10]

senators2 <- hrc[10]

senators2 <- strsplit(senators2, "\n")

senators2 <- senators2[[1]]

#senators2

senators2 <- str_squish(senators2)

#senators2

#new easier method
senators2 <- as.data.frame(senators2)
#filter out rows that do not contain ) 
senators2 %>% filter(str_detect(senators2, "\\)")) -> senators2

#Chuck Schumer's row becomes misaligned due to the footnotes
#Initial value:
#senators2[13,]
# "I LEVINE Schumer, Charles (D) 3, 4 100 100 100 v v v v v v v v v v v v v v N/A N/A N/A v N/A N/A"

#Changing value to remove the "3, 4"

senators2[13,] <- "I LEVINE Schumer, Charles (D) 100 100 100 v v v v v v v v v v v v v v N/A N/A N/A v N/A N/A"


# Robert Casey Jr.'s row also becomse misaligned due to foot notes
#Initial value:
#senators2[24,]
# "R IHRDA Casey Jr., Robert (D) 5 98 97 97 v v v v v v v v v v v J v v j v v v v v"
# Removing the 5

senators2[24,] <- "R IHRDA Casey Jr., Robert (D) 98 97 97 v v v v v v v v v v v J v v j v v v v v"



#senators2 <- senators2[-1,]
#Filter out first row
senators2 <- senators2 %>% 
  filter(senators2 != "SENATOR (Party) SCORE SCORE SCORE A B C D E F G H I J K L M N O P Q R S T")




senators2 %>% separate(senators2, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> senators2

senators2 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                        "vote_tuberville",
                                        "vote_johnLewis",
                                        "vote_filibuster",
                                        "vote_womensHealth",
                                        "vote_saferCommunities",
                                        "vote_lee",
                                        "vote_respectForMarriage",
                                        "vote_buttigieg",
                                        "vote_levine",
                                        "vote_jackson",
                                        "vote_robinson",
                                        "vote_nathan",
                                        "vote_impeachment",
                                        "vote_equalityAct",
                                        "vote_DNHA",
                                        "vote_TFPA",
                                        "vote_SSIA",
                                        "vote_IHRDA",
                                        "vote_ECDFA",
                                        "vote_PrEP"), 
                 sep = " ") -> senators2

senators2 <- senators2 %>% select(-score1) %>%
  rename(score1 = score2, score2 = score3, score3 = score4) %>%
  select(-votes)


hrc_sen <- bind_rows(hrc_sen, senators2) 

########## Page 11

#hrc[11]

senators2 <- hrc[11]

senators2 <- strsplit(senators2, "\n")

senators2 <- senators2[[1]]

#senators2

senators2 <- str_squish(senators2)

#senators2

#new easier method
senators2 <- as.data.frame(senators2)
#filter out rows that do not contain ) 
senators2 %>% filter(str_detect(senators2, "\\)")) -> senators2

senators2 <- senators2 %>% 
  filter(senators2 != "SENATOR (Party) SCORE SCORE SCORE A B C D E F G H I J K L M N O P Q R S T")




senators2 %>% separate(senators2, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> senators2

senators2 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                        "vote_tuberville",
                                        "vote_johnLewis",
                                        "vote_filibuster",
                                        "vote_womensHealth",
                                        "vote_saferCommunities",
                                        "vote_lee",
                                        "vote_respectForMarriage",
                                        "vote_buttigieg",
                                        "vote_levine",
                                        "vote_jackson",
                                        "vote_robinson",
                                        "vote_nathan",
                                        "vote_impeachment",
                                        "vote_equalityAct",
                                        "vote_DNHA",
                                        "vote_TFPA",
                                        "vote_SSIA",
                                        "vote_IHRDA",
                                        "vote_ECDFA",
                                        "vote_PrEP"), 
                 sep = " ") -> senators2

senators2 <- senators2 %>% select(-score1) %>%
  rename(score1 = score2, score2 = score3, score3 = score4) %>%
  select(-votes)


hrc_sen <- bind_rows(hrc_sen, senators2) 


###############################################################
###################### House of Representatives ###############
###############################################################

############### Page 17

#hrc[17] 

reps1 <- hrc[17] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#Raúl Grijalva's votes not transcribe correctly due to line break
#reps1[21,] = "LESKO AND FOXX/ 3 Grijalva, Raúl (D) 100 100 100"

reps1[21,] <- "LESKO AND FOXX/ 3 Grijalva, Raúl (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"

reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

hrc_reps <- reps1

############### Page 18

#hrc[18] 

reps1 <- hrc[18] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 26 Brownley, Julia (D) 100 100 100"

reps1[22,] <- "LESKO AND FOXX/ 26 Brownley, Julia (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)

############### Page 19

#hrc[19] 

reps1 <- hrc[19] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 2 Courtney, Joe (D) 100 100 100"

reps1[22,] <- "LESKO AND FOXX/ 2 Courtney, Joe (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)

############### Page 20

#hrc[20] 

reps1 <- hrc[20] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 4 Johnson Jr., Henry “Hank” (D) 100 100 100"

reps1[22,] <- "LESKO AND FOXX/ 4 Johnson Jr., Henry “Hank” (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 21

#hrc[21] 

reps1 <- hrc[21] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 2 Yakym, Rudy (R)9 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A"

reps1[22,] <- "LESKO AND FOXX/ 2 Yakym, Rudy (R)9 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A j N/A j j j j j v"


reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 22

#hrc[22] 

reps1 <- hrc[22] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed

#No known issues with this page
# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)

############### Page 23

#hrc[23] 

reps1 <- hrc[23] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 6 Emmer, Tom (R) 14 0 0"

reps1[22,] <- "LESKO AND FOXX/ 6 Emmer, Tom (R) 14 0 0 j j j j j v j j j j j j v v j j j j j j j"


# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 24

#hrc[24] 

reps1 <- hrc[24] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 5 Gottheimer, Josh (D) 100 100 100"

reps1[22,] <- "LESKO AND FOXX/ 5 Gottheimer, Josh (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 25

#hrc[25] 

reps1 <- hrc[25] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 24 Katko, John (R) 68 54 61"

reps1[22,] <- "LESKO AND FOXX/ 24 Katko, John (R) 68 54 61 v j j j v v v j v v v v v v v j j v j j v"


# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 26

#hrc[26] 

reps1 <- hrc[26] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 13 Ryan, Tim (D) 100 100 100"

reps1[22,] <- "LESKO AND FOXX/ 13 Ryan, Tim (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 27

#hrc[27] 

reps1 <- hrc[27] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[21,] = "LESKO AND FOXX/ 1 Cicilline, David (D) 100 100 100"

reps1[21,] <- "LESKO AND FOXX/ 1 Cicilline, David (D) 100 100 100 v v v v v v v v v v v v v v v v v v v v v"


# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 28

#hrc[28] 

reps1 <- hrc[28] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 13 Jackson, Ronny (R) 0 N/A N/A"

reps1[22,] <- "LESKO AND FOXX/ 13 Jackson, Ronny (R) 0 N/A N/A j j j j j j j j j j j j j j j j j j j j j"

# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)

############### Page 29

#hrc[29] 

reps1 <- hrc[29] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 6 Cline, Ben (R) 0 0 N/A"

reps1[22,] <- "LESKO AND FOXX/ 6 Cline, Ben (R) 0 0 N/A j j j j j j j j j j j j j j j j j j j j j"

# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#combine
hrc_reps <- bind_rows(hrc_reps, reps1)


############### Page 30

#hrc[30] 

reps1 <- hrc[30] #extract page from PDF document

reps1 <- strsplit(reps1, "\n") #Separate strings by new lines

reps1 <- reps1[[1]] #Only extract information we want

#reps1

reps1 <- str_squish(reps1) #remove all excess white space
#Removing the extra white space reduces the votes for the Delegates from the territories 

#reps1

#new easier method
reps1 <- as.data.frame(reps1) #transform into DF

#### Check and make any changes to lines that were incorrectly transcribed
#reps1[22,] = "LESKO AND FOXX/ 6 Cline, Ben (R) 0 0 N/A"

# reps1[22,] <- "LESKO AND FOXX/ 6 Cline, Ben (R) 0 0 N/A j j j j j j j j j j j j j j j j j j j j j"

# 
# 
reps1 %>% filter(str_detect(reps1, "\\)")) -> reps1 #filter and only keep rows with ) - keeps all rows with political affiliation (R)/(D)

#reps1[1,]

#one row is retained that is not needed - remove
reps1 <- reps1 %>% filter(reps1 != "REPRESENTATIVE (Party) SCORE SCORE SCORE")

reps1 %>% separate(reps1, into = c("name", "score1", "score2", "score3", "votes"), 
                 sep = "\\)") -> reps1

#separate votes into different categories
reps1 %>% separate(score1, into = c("score1", "score2", "score3", "score4", 
                                    "vote_equalityAct",
                                    "vote_AmericanDream",
                                    "vote_backgroundChecks",
                                    "vote_johnLewis",
                                    "vote_violenceAgainstWomen",
                                    "vote_LGBTQ_BECEIA",
                                    "vote_leskoFoxx",
                                    "vote_womensHealth",
                                    "vote_FVPSA",
                                    "vote_globalRespect",
                                    "vote_LGBTQIdataInclusion",
                                    "vote_saferCommunities",
                                    "vote_RMA_first",
                                    "vote_RMA_final",
                                    "vote_impeachment",
                                    "vote_DNHA",
                                    "vote_TFPA",
                                    "vote_SSIA",
                                    "vote_ECDFA",
                                    "vote_PrEP",
                                    "vote_anti-transDischarge"), 
                 sep = " ") -> reps1


reps1 <- reps1 %>% select(-score1, -votes) %>%
  rename(score1 = score2, score2 = score3, score3 = score4)

#Fix the voting records for Territory Delegates

reps1 <- reps1 %>%
  mutate(vote_equalityAct = case_when( #change values to NA for Equality Act
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_equalityAct
  ),
  #American Dream
  vote_AmericanDream = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_AmericanDream
  ),
  #Background checks
  vote_backgroundChecks = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_backgroundChecks
  ),
  #vote John Lewis
  vote_johnLewis = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_johnLewis
  ),
  #violence against women
  vote_violenceAgainstWomen = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_violenceAgainstWomen
  ),
  #LGBTQIA BECEIA
  vote_LGBTQ_BECEIA = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_LGBTQ_BECEIA
  ),
  #Lesko Foxx
  vote_leskoFoxx = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_leskoFoxx
  ),
  #women's health
  vote_womensHealth = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_womensHealth
  ),
  #FVPSA
  vote_FVPSA = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_FVPSA
  ),
  #Global Respect
  vote_globalRespect = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_globalRespect
  ),
  #LGBTQIA Data Inclusion
  vote_LGBTQIdataInclusion = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_LGBTQIdataInclusion
  ),
  #Safter Communities
  vote_saferCommunities = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_saferCommunities
  ),
  #RMA first
  vote_RMA_first = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_RMA_first
  ),
  #RMA Final
  vote_RMA_final = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_RMA_final
  ),
  #Impeachment
  vote_impeachment = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ vote_impeachment
  ),
  #DNHA
  vote_DNHA = case_when(
    name == "AL Amata Coleman (R" ~ "j",
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ "v",
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ "j",
    name == "Q TFPA AL Sablan, Gregorio (D" ~ "v",
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ "j",
    name == "AL Plaskett, Stacey (D" ~ "j",
    TRUE ~ vote_DNHA
  ),
  #TFPA
  vote_TFPA = case_when(
    name == "AL Amata Coleman (R" ~ "j",
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ "v",
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ "j",
    name == "Q TFPA AL Sablan, Gregorio (D" ~ "v",
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ "j",
    name == "AL Plaskett, Stacey (D" ~ "j",
    TRUE ~ vote_TFPA
  ),
  #SSIA
  vote_SSIA = case_when(
    name == "AL Amata Coleman (R" ~ "j",
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ "v",
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ "v",
    name == "Q TFPA AL Sablan, Gregorio (D" ~ "j",
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ "j",
    name == "AL Plaskett, Stacey (D" ~ "j",
    TRUE ~ vote_SSIA
  ),
  #ECDFA
  vote_ECDFA = case_when(
    name == "AL Amata Coleman (R" ~ "j",
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ "v",
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ "v",
    name == "Q TFPA AL Sablan, Gregorio (D" ~ "v",
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ "v",
    name == "AL Plaskett, Stacey (D" ~ "v",
    TRUE ~ vote_ECDFA
  ),
  #PrEP Access
  vote_PrEP = case_when(
    name == "AL Amata Coleman (R" ~ "j",
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ "v",
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ "v",
    name == "Q TFPA AL Sablan, Gregorio (D" ~ "v",
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ "j",
    name == "AL Plaskett, Stacey (D" ~ "j",
    TRUE ~ vote_PrEP
  ),
  #Anti-trans discharge
  `vote_anti-transDischarge` = case_when(
    name == "AL Amata Coleman (R" ~ NA_character_,
    name == "O IMPEACHMENT AL Norton, Eleanor Holmes (D" ~ NA_character_,
    name == "P DNHA AL San Nicolas, Michael F.Q. (D" ~ NA_character_,
    name == "Q TFPA AL Sablan, Gregorio (D" ~ NA_character_,
    name == "R SSIA AL González-Colón, Jenniffer (R" ~ NA_character_,
    name == "AL Plaskett, Stacey (D" ~ NA_character_,
    TRUE ~ `vote_anti-transDischarge`
  ))


#combine
hrc_reps <- bind_rows(hrc_reps, reps1)

Here are the members of the 117th Congress and their HRC scores on equality.

Representatives

hrc_reps <- hrc_reps %>%
  rename(score_117 = score1,
         score_116 = score2,
         score_115 = score3)

#CHANGE THE CHARACTERS RE VOTING

hrc_reps %>% mutate_at(vars(5:25),
                            funs(case_when(
  . == "j" ~ "anti-HRC",
  . =="v" ~ "pro-HRC",
  . == "J" ~ "did not vote",
  . == "P" ~ "voted present",
  TRUE ~ .
))) -> hrc_reps



#clean up names

hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot2, "\\,")) %>%
  select(-spot1, -spot4:-spot10 )%>%
  rename(last_name = spot2, first_name = spot3) -> hrc_rep_df


hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot3, "\\,")) %>%
  select(-spot1) %>%
  mutate(spot2 = case_when(
    spot2 == "13" ~ NA_character_,
    spot2 == "51" ~ NA_character_,
    spot2 == "19" ~ NA_character_,
    spot2 == "8" ~ NA_character_,
    spot2 == "11" ~ NA_character_,
    spot2 == "7" ~ NA_character_,
    TRUE ~ spot2
  )) %>%
  unite("last_name", spot2, spot3, sep = " ", na.rm= T) %>%
  rename(first_name = spot4) %>%
  select(-spot5:-spot10) -> hrc_rep_df2
  
hrc_rep_df <- bind_rows(hrc_rep_df, hrc_rep_df2)


hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot4, "\\,")) %>%
  select(-spot1:-spot3) %>%
  rename(last_name = spot4) %>%
  unite("first_name", spot5, spot6, sep = " ", na.rm = T) %>%
  select(-spot7:-spot10) -> hrc_rep_df2

hrc_rep_df <- bind_rows(hrc_rep_df, hrc_rep_df2)

hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot5, "\\,")) %>%
  select(-spot1:-spot3) %>%
  mutate(spot4 = case_when(
    spot4 %in% c("1","2","3","4","5","6","9","10","12","13","14","15","24",
                 "26", "34", "36", "53", "21", "23") ~ NA_character_,
    TRUE ~ spot4
  )) %>%
  unite("last_name", spot4, spot5, sep = " ", na.rm = T) %>%
  rename(first_name = spot6) %>%
  select(-spot7:-spot10) -> hrc_rep_df2

hrc_rep_df <- bind_rows(hrc_rep_df, hrc_rep_df2)


hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot6, "\\,")) %>%
  select(-spot1:-spot4) %>%
  mutate(spot5 = case_when(
    spot5 %in% c("1","2","3","4","5","6","9","10","12","13","14","15","24",
                 "26","34","36","53","21","23","11","17","AL","25","19",
                 "37", "39","7") ~ NA_character_,
    TRUE ~ spot5
  )) %>%
  unite("last_name", spot5, spot6, sep = " ", na.rm = T) %>%
  rename(first_name = spot7) %>%
  select(-spot8:-spot10) -> hrc_rep_df2

hrc_rep_df <- bind_rows(hrc_rep_df, hrc_rep_df2)

hrc_reps %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5",
                          "spot6", "spot7","spot8","spot9","spot10"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot7, "\\,")) %>%
  select(-spot1:-spot5) %>%
  unite("last_name", spot6, spot7, sep = " ") %>%
  select(-spot9:-spot10)%>%
  rename(first_name = spot8) -> hrc_rep_df2

hrc_rep_df <- bind_rows(hrc_rep_df, hrc_rep_df2)

hrc_rep_df %>% unite("name", first_name, last_name, sep = " ", remove = F) %>%
  mutate(name = str_replace(name, "[[:punct:]]", "")) -> hrc_rep_df

#clean up the names and remove additional spaces
hrc_rep_df$name <- str_squish(hrc_rep_df$name)

#Change columns to numeric and not characters
hrc_rep_df$score_117 <- as.numeric(hrc_rep_df$score_117)
hrc_rep_df$score_116 <- as.numeric(hrc_rep_df$score_116)
hrc_rep_df$score_115 <- as.numeric(hrc_rep_df$score_115)
#calculate their average score based on previous voting record
hrc_rep_df %>% 
  select(-last_name, - first_name) %>% #drop columns for tidiness
  pivot_longer(score_117:score_115, names_to = "session", values_to = "score") %>%
  group_by(name) %>% #group reps
  summarise(name = name,
            avg_score = round(mean(score, na.rm = T),2)) %>%
  unique() %>% #drop duplicates
  ungroup() %>%
  right_join(hrc_rep_df, by = "name") -> hrc_rep_df

The table below shows the House of Representatives and their scores of equality based on their voting record (when available). The column avg_score calculate the average of the available equality scores from the HRC. Not all Representatives served in prior congressional sessions, which is reflected by “NA” and does not count towards the avg_score.

#print table
hrc_rep_df %>%
  select(name, ID, avg_score, score_117, score_116, score_115) %>%
  arrange(name)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ID avg_score score_117 score_116 score_115
Abigail Spanberger D 100.00 100 100 NA
Adam Kinzinger R 24.67 60 11 3
Adam Schiff D 100.00 100 100 100
Adam Smith D 100.00 100 100 100
Adrian Smith R 0.00 0 0 0
Adriano Espaillat D 100.00 100 100 100
Al Green D 95.00 94 100 91
Al Lawson D 98.67 96 100 100
Alan Lowenthal D 100.00 100 100 100
Albio Sires D 99.33 98 100 100
Alex Mooney R 0.00 0 0 0
Alexandria OcasioCortez, D 100.00 100 100 NA
Alma Adams D 98.00 94 100 100
Ami Bera D 100.00 100 100 100
André Carson D 100.00 100 100 100
Andrew Clyde R 0.00 0 NA NA
Andrew Garbarino R 26.00 26 NA NA
Andy Barr R 0.00 0 0 0
Andy Biggs R 5.00 0 0 15
Andy Harris R 0.00 0 0 0
Andy Kim D 100.00 100 100 NA
Andy Levin D 97.00 94 100 NA
Angie Craig D 100.00 100 100 NA
Ann Kirkpatrick D 100.00 100 100 NA
Ann Kuster D 100.00 100 100 100
Ann Wagner R 5.00 8 7 0
Anna Eshoo D 99.33 98 100 100
Anthony Brown D 100.00 100 100 100
Anthony Gonzalez R 28.00 49 7 NA
Ashley Hinson R 14.00 14 NA NA
August Pfluger R 0.00 0 NA NA
Austin Scott R 0.00 0 0 0
Ayanna Pressley D 100.00 100 100 NA
Barbara Lee D 100.00 100 100 100
Barry Loudermilk R 0.00 0 0 0
Barry Moore R 0.00 0 NA NA
Ben Cline R 0.00 0 0 NA
Bennie Thompson D 98.00 94 100 100
Beth Van Duyne R 0.00 0 NA NA
Betty McCollum D 100.00 100 100 100
Bill Foster D 100.00 100 100 100
Bill Huizenga R 0.00 0 0 0
Bill Johnson R 0.00 0 0 0
Bill Keating D 99.33 98 100 100
Bill Pascrell Jr, D 100.00 100 100 100
Bill Posey R 0.00 0 0 0
Billy Long R 0.00 0 0 0
Blaine Luetkemeyer R 0.00 0 0 0
Blake Moore R 8.00 8 NA NA
Bob Gibbs R 0.00 0 0 0
Bob Good R 0.00 0 NA NA
Bobby Rush D 98.67 96 100 100
Bonnie Watson Coleman D 100.00 100 100 100
Brad Finstad R NaN NA NA NA
Brad Schneider D 100.00 100 100 100
Brad Sherman D 100.00 100 100 100
Brad Wenstrup R 0.00 0 0 0
Brenda Lawrence D 100.00 100 100 100
Brendan Boyle D 100.00 100 100 100
Brett Guthrie R 0.00 0 0 0
Brian Babin R 0.00 0 0 0
Brian Fitzpatrick R 66.67 68 71 61
Brian Higgins D 100.00 100 100 100
Brian Mast R 3.67 4 7 0
Bruce Westerman R 0.00 0 0 0
Bryan Steil R 10.50 14 7 NA
Buddy Carter R 0.00 0 0 0
Burgess Owens R 4.00 4 NA NA
Byron Donalds R 0.00 0 NA NA
C Franklin, R 0.00 0 NA NA
Carlos Gimenez R 32.00 32 NA NA
Carol Miller R 0.00 0 0 NA
Carolyn Bourdeaux D 98.00 98 NA NA
Carolyn Maloney D 100.00 100 100 100
Cathy McMorris Rodgers R 0.00 0 0 0
Chellie Pingree D 100.00 100 100 100
Cheri Bustos D 100.00 100 100 100
Chip Roy R 0.00 0 0 NA
Chris Jacobs R 20.00 20 NA NA
Chris Pappas D 100.00 100 100 NA
Chris Smith R 15.00 13 17 15
Chris Stewart R 4.33 10 3 0
Chrissy Houlahan D 99.00 98 100 NA
Chuck Fleischmann R 0.00 0 0 0
Cindy Axne D 96.50 96 97 NA
Claudia Tenney R 0.00 0 NA NA
Clay Higgins R 0.00 0 0 0
Cliff Bentz R 4.00 4 NA NA
Colin Allred D 98.50 100 97 NA
Connie Conway R NaN NA NA NA
Conor Lamb D 95.00 98 94 93
Cori Bush D 100.00 100 NA NA
Dan Bishop R 0.00 0 NA NA
Dan Crenshaw R 0.00 0 0 NA
Dan Kildee D 100.00 100 100 100
Dan Meuser R 2.00 4 0 NA
Dan Newhouse R 11.00 26 7 0
Daniel Webster R 0.00 0 0 0
Danny Davis D 95.00 100 97 88
Darin LaHood R 0.00 0 0 0
Darrell Issa R 19.50 14 NA 25
Darren Soto D 100.00 100 100 100
David Cicilline D 100.00 100 100 100
David Joyce R 17.00 26 7 18
David Kustoff R 0.00 0 0 0
David McKinley R 2.00 6 0 0
David Price D 100.00 100 100 100
David Rouzer R 0.00 0 0 0
David Schweikert R 0.00 0 0 0
David Scott D 96.00 100 100 88
David Trone D 100.00 100 100 NA
David Valadao R 27.00 34 NA 20
Dean Phillips D 100.00 100 100 NA
Debbie Dingell D 100.00 100 100 100
Debbie Lesko R 0.00 0 0 0
Debbie Wasserman Schultz D 100.00 100 100 100
Deborah Ross D 100.00 100 NA NA
Derek Kilmer D 100.00 100 100 100
Diana DeGette D 100.00 100 100 100
Diana Harshbarger R 0.00 0 NA NA
Dina Titus D 100.00 100 100 100
Don Bacon R 9.00 20 7 0
Don Beyer D 100.00 100 100 100
Donald McEachin D 100.00 100 100 100
Donald Norcross D 100.00 100 100 100
Donald Payne Jr, D 100.00 100 100 100
Doris Matsui D 100.00 100 100 100
Doug LaMalfa R 0.00 0 0 0
Doug Lamborn R 0.00 0 0 0
Drew Ferguson R 0.00 0 0 0
Dusty Johnson R 0.00 0 0 NA
Dutch Ruppersberger D 100.00 100 100 100
Dwight Evans D 100.00 100 100 100
Earl Blumenauer D 100.00 100 100 100
Ed Case D 96.50 96 97 NA
Ed Perlmutter D 99.33 98 100 100
Eddie Bernice Johnson D 96.00 100 100 88
Elaine Luria D 95.50 100 91 NA
Eleanor Holmes Norton D 100.00 100 100 100
Elise Stefanik R 31.33 8 40 46
Elissa Slotkin D 100.00 100 100 NA
Emanuel Cleaver D 90.33 98 97 76
Eric Swalwell D 100.00 100 100 100
Frank Lucas R 0.00 0 0 0
Frank Mrvan D 98.00 98 NA NA
Frank Pallone Jr, D 98.67 96 100 100
Fred Keller R 0.00 0 0 NA
Fred Upton R 38.33 58 42 15
Frederica Wilson D 97.00 100 100 91
French Hill R 0.00 0 0 0
Garret Graves R 0.00 0 0 0
Gary Palmer R 0.00 0 0 0
Gerald Connolly D 100.00 100 100 100
GK. Butterfield, D 87.33 92 88 82
Glenn Grothman R 0.00 0 0 0
Glenn Thompson R 0.00 0 0 0
Grace Meng D 100.00 100 100 100
Grace Napolitano D 100.00 100 100 100
Greg Murphy R 6.00 6 NA NA
Greg Pence R 3.50 7 0 NA
Greg Stanton D 100.00 100 100 NA
Greg Steube R 0.00 0 0 NA
Gregorio Sablan D 63.00 80 69 40
Gregory Meeks D 98.33 98 100 97
Gus Bilirakis R 0.00 0 0 0
Guy Reschenthaler R 0.00 0 0 NA
Gwen Moore D 96.33 98 97 94
Hakeem Jeffries D 100.00 100 100 100
Haley Stevens D 100.00 100 100 NA
Harold Rogers R 0.67 2 0 0
Henry Cuellar D 81.33 84 75 85
Henry Johnson Jr, D 100.00 100 100 100
Ilhan Omar D 100.00 100 100 NA
Jack Bergman R 8.33 0 0 25
Jackie Speier D 99.33 98 100 100
Jahana Hayes D 100.00 100 100 NA
Jaime Herrera Beutler R 11.00 10 8 15
Jake Auchincloss D 100.00 100 NA NA
Jake Ellzey R 0.00 0 0 NA
Jake LaTurner R 0.00 0 NA NA
Jamaal Bowman D 100.00 100 NA NA
James Clyburn D 95.00 100 100 85
James Comer R 0.00 0 0 0
James McGovern D 100.00 100 100 100
Jamie Raskin D 100.00 100 100 100
Jan Schakowsky D 100.00 100 100 100
Jared Golden D 90.00 90 90 NA
Jared Huffman D 100.00 100 100 100
Jason Crow D 100.00 100 100 NA
Jason Smith R 0.00 0 0 0
Jay Obernolte R 14.00 14 NA NA
Jeff Duncan R 0.00 0 0 0
Jeff Van Drew R 50.00 22 78 NA
Jennifer Wexton D 100.00 100 100 NA
Jenniffer GonzálezColón, R 9.67 20 9 0
Jerrold Nadler D 100.00 100 100 100
Jerry Carl R 0.00 0 NA NA
Jerry McNerney D 98.33 98 100 97
Jesús García D 100.00 100 100 NA
Jim Baird R 0.00 0 0 NA
Jim Banks R 0.00 0 0 0
Jim Cooper D 97.33 98 100 94
Jim Costa D 98.00 100 97 97
Jim Himes D 100.00 100 100 100
Jim Jordan R 0.00 0 0 0
Jim Langevin D 100.00 100 100 100
Jimmy Gomez D 100.00 100 100 100
Jimmy Panetta D 100.00 100 100 100
Joaquin Castro D 100.00 100 100 100
Jodey Arrington R 0.00 0 0 0
Jody Hice R 0.00 0 0 0
Joe Courtney D 100.00 100 100 100
Joe Neguse D 100.00 100 100 NA
Joe Sempolinski R NaN NA NA NA
Joe Wilson R 0.00 0 0 0
John Carter R 4.33 6 7 0
John Curtis R 2.67 8 0 0
John Garamendi D 100.00 100 100 100
John Joyce R 1.00 2 0 NA
John Katko R 61.00 68 54 61
John Larson D 100.00 100 100 100
John Moolenaar R 0.00 0 0 0
John Rose R 0.00 0 0 NA
John Rutherford R 0.00 0 0 0
John Sarbanes D 97.00 100 100 91
John Yarmuth D 100.00 100 100 100
Joseph Morelle D 100.00 100 100 NA
Josh Gottheimer D 100.00 100 100 100
Josh Harder D 97.00 94 100 NA
Joyce Beatty D 100.00 100 100 100
Juan Vargas D 100.00 100 100 100
Judy Chu D 100.00 100 100 100
Julia Brownley D 100.00 100 100 100
Julia Letlow R 0.00 0 NA NA
Kaialii Kahele, D 94.00 94 NA NA
Karen Bass D 100.00 100 100 100
Kat Cammack R 8.00 8 NA NA
Katherine Clark D 100.00 100 100 100
Kathleen Rice D 100.00 100 100 100
Kathy Castor D 98.00 94 100 100
Kathy Manning D 100.00 100 NA NA
Katie Porter D 100.00 100 100 NA
Kay Granger R 0.67 2 0 0
Kelly Armstrong R 4.00 8 0 NA
Ken Buck R 0.00 0 0 0
Ken Calvert R 4.67 14 0 0
Kevin Brady R 0.67 2 0 0
Kevin Hern R 0.00 0 0 NA
Kevin McCarthy R 0.00 0 0 0
Kim Schrier D 100.00 100 100 NA
Kurt Schrader D 99.00 100 97 100
Kweisi Mfume D 100.00 100 NA NA
Lance Gooden R 0.00 0 0 NA
Larry Bucshon R 0.00 0 0 0
Lauren Boebert R 0.00 0 NA NA
Lauren Underwood D 98.50 100 97 NA
Lee Zeldin R 7.33 12 7 3
Linda Sánchez D 100.00 100 100 100
Lisa Blunt Rochester D 98.00 100 100 94
Lisa McClain R 0.00 0 NA NA
Liz Cheney R 7.67 23 0 0
Lizzie Fletcher D 100.00 100 100 NA
Lloyd Doggett D 100.00 100 100 100
Lloyd Smucker R 0.00 0 0 0
Lois Frankel D 100.00 100 100 100
Lori Trahan D 100.00 100 100 NA
Lou Correa D 100.00 100 100 100
Louie Gohmert R 0.00 0 0 0
Lucille RoybalAllard, D 100.00 100 100 100
Lucy McBath D 100.00 100 100 NA
Madeleine Dean D 100.00 100 100 NA
Madison Cawthorn R 0.00 0 NA NA
Marc Veasey D 97.00 94 100 97
Marcy Kaptur D 99.00 100 97 100
Maria Salazar R 38.00 38 NA NA
Mariannette MillerMeeks, R 20.00 20 NA NA
Marie Newman D 100.00 100 NA NA
Marilyn Strickland D 100.00 100 NA NA
Mario DiazBalart, R 25.67 22 40 15
Marjorie Greene R 0.00 0 NA NA
Mark Amodei R 6.00 0 0 18
Mark DeSaulnier D 100.00 100 100 100
Mark Green R 0.00 0 0 NA
Mark Pocan D 100.00 100 100 100
Mark Takano D 100.00 100 100 100
Markwayne Mullin R 2.00 6 0 0
Mary Miller R 0.00 0 NA NA
Mary Peltola D NaN NA NA NA
Mary Scanlon D 100.00 100 100 NA
Matt Gaetz R 0.00 0 0 0
Matthew Cartwright D 100.00 100 100 100
Matthew Rosendale R 0.00 0 NA NA
Maxine Waters D 100.00 100 100 100
Mayra Flores R NaN NA NA NA
Melanie Stansbury D 100.00 100 NA NA
Michael Burgess R 0.00 0 0 0
Michael Cloud R 0.00 0 0 NA
Michael Guest R 0.00 0 0 NA
Michael McCaul R 5.00 8 7 0
Michael San Nicolas D 64.50 60 69 NA
Michael Turner R 13.00 15 9 15
Michael Waltz R 7.50 8 7 NA
Michelle Fischbach R 0.00 0 NA NA
Michelle Steel R 6.00 6 NA NA
Mike Bost R 8.67 18 8 0
Mike Carey R NaN NA NA NA
Mike Doyle D 100.00 100 100 100
Mike Flood R NaN NA NA NA
Mike Gallagher R 1.33 4 0 0
Mike Garcia R 14.00 14 NA NA
Mike Johnson R 0.00 0 0 0
Mike Kelly R 0.00 0 0 0
Mike Levin D 100.00 100 100 NA
Mike Quigley D 100.00 100 100 100
Mike Rogers R 0.00 0 0 0
Mike Simpson R 7.67 16 7 0
Mike Thompson D 100.00 100 100 100
Mikie Sherrill D 100.00 100 100 NA
Mo Brooks R 0.00 0 0 0
Mondaire Jones D 100.00 100 NA NA
Morgan Griffith R 2.00 6 0 0
Nancy Mace R 14.00 14 NA NA
Nancy Pelosi D 100.00 100 100 100
Nanette Barragán D 100.00 100 100 100
Neal Dunn R 0.00 0 0 0
Nicole Malliotakis R 20.00 20 NA NA
Nikema Williams D 100.00 100 NA NA
Norma Torres D 100.00 100 100 100
Nydia Velázquez D 100.00 100 100 100
Pat Fallon R 0.00 0 0 NA
Pat Ryan D NaN NA NA NA
Patrick McHenry R 2.67 8 0 0
Paul Gosar R 0.00 0 0 0
Paul Tonko D 100.00 100 100 100
Pete Aguilar D 100.00 100 100 100
Pete Sessions R 0.00 0 NA 0
Pete Stauber R 6.50 6 7 NA
Peter DeFazio D 100.00 100 100 100
Peter Meijer R 40.00 40 NA NA
Peter Welch D 100.00 100 100 100
Pramila Jayapal D 100.00 100 100 100
Raja Krishnamoorthi D 100.00 100 100 100
Ralph Norman R 0.00 0 0 0
Randy Feenstra R 0.00 0 NA NA
Randy Weber R 0.00 0 0 0
Rashida Tlaib D 100.00 100 100 NA
Raúl Grijalva D 100.00 100 100 100
Raul Ruiz D 100.00 100 100 100
Richard Hudson R 0.00 0 0 0
Richard Neal D 99.33 98 100 100
Rick Allen R 0.00 0 0 0
Rick Crawford R 0.00 0 0 0
Rick Larsen D 100.00 100 100 100
Ritchie Torres D 100.00 100 NA NA
Ro Khanna D 99.33 98 100 100
Robert Aderholt R 0.00 0 0 0
Robert Latta R 0.00 0 0 0
Robert Scott D 96.00 94 97 97
Robert Wittman R 0.00 0 0 0
Robin Kelly D 100.00 100 100 100
Rodney Davis R 11.00 26 7 0
Roger Williams R 2.33 0 7 0
Ron Estes R 0.00 0 0 0
Ron Kind D 99.33 98 100 100
Ronny Jackson R 0.00 0 NA NA
Rosa DeLauro D 99.33 98 100 100
Ruben Gallego D 100.00 100 100 100
Rudy Yakym R NaN NA NA NA
Russ Fulcher R 0.00 0 0 NA
Salud Carbajal D 100.00 100 100 100
Sam Graves R 0.00 0 0 0
Sanford Bishop Jr, D 89.00 98 87 82
Sara Jacobs D 100.00 100 NA NA
Scott DesJarlais R 0.00 0 0 0
Scott Fitzgerald R 0.00 0 NA NA
Scott Perry R 2.00 6 0 0
Scott Peters D 100.00 100 100 100
Sean Casten D 100.00 100 100 NA
Sean Maloney D 100.00 100 100 100
Seth Moulton D 100.00 100 100 100
Sharice Davids D 98.50 100 97 NA
Sheila CherfilusMcCormick, D NaN NA NA NA
Sheila Jackson Lee D 99.33 98 100 100
Shontel Brown D NaN NA NA NA
Stacey Plaskett D 41.00 20 53 50
Steny Hoyer D 99.00 100 100 97
Stephanie Bice R 6.00 6 NA NA
Stephanie Murphy D 98.00 94 100 100
Stephen Lynch D 100.00 100 100 100
Steve Chabot R 2.00 6 0 0
Steve Cohen D 100.00 100 100 100
Steve Scalise R 0.00 0 0 0
Steve Womack R 0.00 0 0 0
Steven Horsford D 100.00 100 100 NA
Steven Palazzo R 0.00 0 0 0
Susan Wild D 100.00 100 100 NA
Susie Lee D 97.50 98 97 NA
Suzan DelBene D 100.00 100 100 100
Suzanne Bonamici D 100.00 100 100 100
Sylvia Garcia D 100.00 100 100 NA
Ted Budd R 0.00 0 0 0
Ted Lieu D 100.00 100 100 100
Teresa Leger Fernández D 100.00 100 NA NA
Terri Sewell D 92.67 96 97 85
Thomas Massie R 5.00 0 0 15
Thomas Suozzi D 100.00 100 100 100
Tim Burchett R 4.50 0 9 NA
Tim Ryan D 100.00 100 100 100
Tim Walberg R 0.00 0 0 0
Tom Cole R 8.33 18 7 0
Tom Emmer R 4.67 14 0 0
Tom Malinowski D 100.00 100 100 NA
Tom McClintock R 0.00 0 0 0
Tom OHalleran, D 99.00 100 97 100
Tom Rice R 6.67 20 0 0
Tom Tiffany R 0.00 0 NA NA
Tony Cárdenas D 99.33 98 100 100
Tony Gonzales R 20.00 20 NA NA
Tracey Mann R 0.00 0 NA NA
Trent Kelly R 0.00 0 0 0
Trey Hollingsworth R 5.33 2 14 0
Troy Balderson R 6.50 6 7 NA
Troy Carter D 88.00 88 NA NA
Troy Nehls R 0.00 0 NA NA
Val Demings D 100.00 100 100 100
Van Taylor R 0.00 0 0 NA
Vern Buchanan R 4.33 6 7 0
Veronica Escobar D 100.00 100 100 NA
Vicente Gonzalez D 91.00 100 88 85
Vicky Hartzler R 0.00 0 0 0
Victoria Spartz R 0.00 0 NA NA
Virginia Foxx R 0.00 0 0 0
Warren Davidson R 0.00 0 0 0
William Timmons R 0.00 0 0 NA
Young Kim R 26.00 26 NA NA
Yvette Clarke D 100.00 100 100 100
Yvette Herrell R 0.00 0 NA NA
Zoe Lofgren D 100.00 100 100 100

Senators

#rename score variabels
hrc_sen <- hrc_sen %>%
  rename(score_117 = score1,
         score_116 = score2,
         score_115 = score3)

#CHANGE THE CHARACTERS RE VOTING

hrc_sen %>% mutate_at(vars(5:24),
                            funs(case_when(
  . == "j" ~ "anti-HRC",
  . =="v" ~ "pro-HRC",
  . == "J" ~ "did not vote",
  . == "P" ~ "voted present",
  TRUE ~ .
))) -> hrc_sen


#clean up names

hrc_sen %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot1, "\\,")) %>%
  select(-spot3, -spot4, -spot5)%>%
  rename(last_name = spot1, first_name = spot2) -> hrc_sen_df



hrc_sen %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot2, "\\,")) %>%
  unite("last_name", spot1, spot2, sep = " ") %>%
  select(-spot4, -spot5) %>%
  rename(first_name = spot3) -> hrc_sen_df2

hrc_sen_df <- bind_rows(hrc_sen_df, hrc_sen_df2)


hrc_sen %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot3, "\\,")) %>%
  select(-spot1, -spot2, -spot5) %>%
  rename(last_name = spot3, first_name = spot4) -> hrc_sen_df2

hrc_sen_df <- bind_rows(hrc_sen_df, hrc_sen_df2)


hrc_sen %>% separate(name, into = c("Name", "ID"),
                     sep = "\\(") %>%
  separate(Name, into = c("spot1", "spot2", "spot3", "spot4", "spot5"),
           sep = "[[:blank:]]") %>%
  filter(str_detect(spot4, "\\,")) %>%
  select(-spot1, -spot2, -spot3) %>%
  rename(last_name = spot4, first_name = spot5) -> hrc_sen_df2

hrc_sen_df <- bind_rows(hrc_sen_df, hrc_sen_df2)

#make a new column with their name
hrc_sen_df <- hrc_sen_df %>% unite("name", first_name, last_name, sep = " ", remove = F) 

hrc_sen_df <- hrc_sen_df %>% mutate(name = str_replace_all(name,"[[:punct:]]", ""))

hrc_sen_df$name <- str_squish(hrc_sen_df$name)

#Robert/Bob Casey's name got messed up 
hrc_sen_df <- hrc_sen_df %>% 
  mutate(name = case_when(
  name == "Robert Jr" ~ "Bob Casey",
  TRUE ~ name),
  last_name = case_when(
    last_name == "Jr.," ~ "Casey Jr.",
TRUE ~ last_name
))


# Convert scores to numeric

hrc_sen_df$score_117 <- as.numeric(hrc_sen_df$score_117)
hrc_sen_df$score_116 <- as.numeric(hrc_sen_df$score_116)
hrc_sen_df$score_115 <- as.numeric(hrc_sen_df$score_115)
#Calculate average score based on previous voting record

hrc_sen_df %>%
  select(-last_name, -first_name) %>% #drop columns for tidiness
  pivot_longer(score_117:score_115, names_to = "session", values_to = "score") %>%
  group_by(name) %>% #group reps
  summarise(name = name,
            avg_score = round(mean(score, na.rm = T),2)) %>%
  unique() %>% #drop duplicates
  ungroup() %>% #ungroup observations
  right_join(hrc_sen_df, by = "name") -> hrc_sen_df

The table below shows the Senators and their scores of equality based on their voting record (when available). The column avg_score calculate the average of the available equality scores from the HRC. Not all Senators served in prior congressional sessions, which is reflected by “NA” and does not count towards the avg_score.

#print table
hrc_sen_df %>%
  select(name, ID, avg_score, score_117, score_116, score_115) %>%
  arrange(name)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ID avg_score score_117 score_116 score_115
Alex Padilla D 100.00 100 NA NA
Amy Klobuchar D 100.00 100 100 100
Angus King I 89.00 92 87 88
Ben Luján D 100.00 100 NA NA
Ben Sasse R 4.33 13 0 0
Benjamin Cardin D 100.00 100 100 100
Bernard Sanders I 100.00 100 100 100
Bill Hagerty R 0.00 0 NA NA
Bob Casey D 97.33 98 97 97
Brian Schatz D 90.33 92 88 91
Catherine Cortez Masto D 99.00 100 97 100
Charles Schumer D 100.00 100 100 100
Chris Coons D 97.00 100 97 94
Chris Van Hollen D 100.00 100 100 100
Christopher Murphy D 100.00 100 100 100
Chuck Grassley R 1.67 5 0 0
Cindy HydeSmith R 2.50 5 0 NA
Cory Booker D 100.00 100 100 100
Cynthia Lummis R 13.00 13 NA NA
Dan Sullivan R 4.67 14 0 0
Deb Fischer R 1.67 5 0 0
Debbie Stabenow D 100.00 100 100 100
Dianne Feinstein D 100.00 100 100 100
Ed Markey D 100.00 100 100 100
Elizabeth Warren D 100.00 100 100 100
Gary Peters D 93.67 96 91 94
Jack Reed D 100.00 100 100 100
Jacky Rosen D 100.00 100 100 NA
James Inhofe R 1.67 5 0 0
James Lankford R 0.00 0 0 0
James Risch R 1.67 5 0 0
Jeanne Shaheen D 100.00 100 100 100
Jeff Merkley D 100.00 100 100 100
Jerry Moran R 1.67 5 0 0
John Barrasso R 1.67 5 0 0
John Boozman R 1.67 5 0 0
John Cornyn R 3.67 11 0 0
John Hickenlooper D 100.00 100 NA NA
John Hoeven R 1.67 5 0 0
John Kennedy R 3.33 10 0 0
John Thune R 1.67 5 0 0
Jon Ossoff D 92.00 92 NA NA
Jon Tester D 86.67 90 82 88
Joni Ernst R 6.33 19 0 0
Joseph Manchin D 45.67 49 58 30
Josh Hawley R 0.00 0 0 NA
Kevin Cramer R 2.50 5 0 NA
Kirsten Gillibrand D 98.67 96 100 100
Kyrsten Sinema D 88.00 90 86 NA
Lindsey Graham R 9.33 16 0 12
Lisa Murkowski R 37.33 55 3 54
Maggie Hassan D 100.00 100 100 100
Marco Rubio R 0.00 0 0 0
Maria Cantwell D 98.33 98 97 100
Mark Kelly D 94.00 94 NA NA
Mark Warner D 92.00 94 91 91
Marsha Blackburn R 0.00 0 0 NA
Martin Heinrich D 96.00 100 97 91
Mazie Hirono D 99.33 98 100 100
Michael Bennet D 92.67 94 93 91
Mike Braun R 2.50 5 0 NA
Mike Crapo R 1.67 5 0 0
Mike Lee R 1.67 5 0 0
Mike Rounds R 2.00 6 0 0
Mitch McConnell R 4.67 14 0 0
Mitt Romney R 19.00 31 7 NA
Patrick Leahy D 98.00 94 100 100
Patrick Toomey R 5.00 15 0 0
Patty Murray D 99.33 98 100 100
Rand Paul R 4.33 5 8 0
Raphael Warnock D 86.00 86 NA NA
Richard Blumenthal D 100.00 100 100 100
Richard Burr R 8.33 25 0 0
Richard Durbin D 100.00 100 100 100
Richard Shelby R 0.00 0 0 0
Rick Scott R 0.00 0 0 NA
Rob Portman R 6.33 19 0 0
Robert Menendez D 99.33 98 100 100
Roger Marshall R 0.00 0 NA NA
Roger Wicker R 1.67 5 0 0
Ron Johnson R 1.67 5 0 0
Ron Wyden D 99.33 98 100 100
Roy Blunt R 6.33 19 0 0
Sheldon Whitehouse D 100.00 100 100 100
Shelley Capito R 6.33 19 0 0
Sherrod Brown D 100.00 100 100 100
Steven Daines R 1.67 5 0 0
Susan Collins R 46.00 54 51 33
Tammy Baldwin D 100.00 100 100 100
Tammy Duckworth D 100.00 100 100 100
Ted Cruz R 0.00 0 0 0
Thom Tillis R 6.67 20 0 0
Thomas Carper D 100.00 100 100 100
Tim Kaine D 93.67 96 94 91
Tim Scott R 0.00 0 0 0
Tina Smith D 100.00 100 100 100
Todd Young R 6.33 19 0 0
Tom Cotton R 0.00 0 0 0
Tommy Tuberville R 0.00 0 0 NA
William Cassidy R 4.00 12 0 0

ASHA-PAC’s Spending by HRC Score

#Make sure names align across DFs

### Representatives

hrc_rep_df$name <- str_squish(hrc_rep_df$name)

hrc_rep_df %>% mutate(name = case_when(
  name == "Frank Pallone Jr," ~ "Frank Pallone Jr.",
  name == "Joe Neguse" ~ "Joseph Neguse",
  name == "GK. Butterfield," ~ "G K Butterfield",
  name == "Lauren Underwood" ~ "Lauren A Underwood",
  name == "Robert Latta" ~ "Bob Latta",
  name == "Robert Scott" ~ "Bobby Scott",
  name == "Richard Neal" ~ "Richard E Neal",
  name == "Bobby Rush" ~ "Bobby L Rush",
  name == "Steny Hoyer" ~ "Steny H Hoyer",
  name == "Vern Buchanan" ~ "Vernon Buchanan",
  name == "Matthew Cartwright" ~ "Matt Cartwright",
  name == "Yvette Clarke" ~ "Yvette D Clarke",
  name == "James Clyburn" ~ "James E Clyburn",
  name == "Danny Davis" ~ "Danny K Davis",
  name == "Tom OHalleran," ~ "Tom O'Halleran",
  name == "Bill Pascrell Jr," ~ "Bill Pascrell Jr.",
  name == "Lucille RoybalAllard," ~ "Lucille Roybal-Allard",
  name == "Terri Sewell" ~ "Terri A Sewell",
  name == "Thomas Suozzi" ~ "Tom Suozzi",
  TRUE ~ name
)) -> hrc_rep_df

ashaPAC %>% mutate(name = case_when(
  name == "Mark Desaulnier" ~ "Mark DeSaulnier",
  name == "David P Joyce" ~ "David Joyce",
  name == "Nanette Barragan" ~ "Nanette Barragán",
  name == "Tony Cardenas" ~ "Tony Cárdenas",
  name == "Yvette Clarke" ~ "Yvette D Clarke",
  name == "Linda Sanchez" ~ "Linda Sánchez",
  name == "Terri Sewell" ~ "Terri A Sewell",

  TRUE ~ name
)) -> ashaPAC
#The following names are Representatives not in the HRC data for the 117th congress. The ones who are not included were in the 116th congress. Their data will be manually added based on the [HRC's report on the 116th Congress](https://hrc-prod-requests.s3-us-west-2.amazonaws.com/116th-Congressional-Scorecard-060921.pdf).   

# ashaPAC %>% filter(role == "Representative") %>%
#   anti_join(hrc_rep_df, by = "name") %>%
#     kbl(table.attr = "style = \"color: black;\"") %>%
#   kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
#   scroll_box(height = "400px")
### Clean up the names of the Senators

hrc_sen_df$name <- str_squish(hrc_sen_df$name)

hrc_sen_df %>% mutate(name = case_when(
  name == "Charles Schumer" ~ "Chuck Schumer",
  name == "Cindy HydeSmith" ~ "Cindy Hyde-Smith",
  name == "William Cassidy" ~ "Bill Cassidy",
  name == "Richard Durbin" ~ "Dick Durbin",
  name == "Shelley Capito" ~ "Shelley Moore Capito",
  TRUE ~ name
)) -> hrc_sen_df

ashaPAC %>% mutate(name = case_when(
  name == "Ben Ray Lujan" ~ "Ben Luján",
  TRUE ~ name
)) -> ashaPAC

#Remove dollar sign from ASHA-PAC total

ashaPAC <- ashaPAC %>% mutate(ASHA_PAC_total = str_replace_all(ASHA_PAC_total, "\\$", ""))
ashaPAC$ASHA_PAC_total<-as.numeric(ashaPAC$ASHA_PAC_total)
#Senators whose names don't match up:

# ashaPAC %>% filter(role == "Senator") %>%
#   anti_join(hrc_sen_df, by = "name") %>%
#   kbl(table.attr = "style = \"color: black;\"") %>%
#   kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
#   scroll_box(height = "400px")

2022

Senators

Senators who won their race, their HRC scores, and the amount that ASHA-PAC has donated to their 2022 campaigns.

#Combine data from HRC and ASHA-PAC spending

ashaPAC %>% select(name, party, state, ASHA_PAC_total, year, role) %>%
  filter(year == "2022", role == "Senator") %>%
  left_join(hrc_sen_df %>% 
              select(name,avg_score, score_117:score_115), by = "name") -> asha_2022_sen

#add Markwayne Mullin's info from Representative HRC data

asha_2022_sen <- asha_2022_sen %>% 
  mutate(score_117 = case_when(
  name == "Markwayne Mullin" ~ 6,
  TRUE ~ score_117),
  score_116 = case_when(
  name == "Markwayne Mullin" ~ 0,
  TRUE ~ score_116),
  score_115 = case_when(
  name == "Markwayne Mullin" ~ 0,
  TRUE ~ score_115),
  avg_score = case_when(
  name == "Markwayne Mullin" ~ (6/3),
  TRUE ~ avg_score  
  ))

asha_2022_sen %>%
  arrange(desc(ASHA_PAC_total)) %>%
  relocate(name, ASHA_PAC_total, avg_score:score_115)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ASHA_PAC_total avg_score score_117 score_116 score_115 party state year role
Patty Murray 6000 99.33 98 100 100 D WA 2022 Senator
Maggie Hassan 5000 100.00 100 100 100 D NH 2022 Senator
Ron Wyden 5000 99.33 98 100 100 D OR 2022 Senator
Lisa Murkowski 4000 37.33 55 3 54 R AK 2022 Senator
Bob Casey 2500 97.33 98 97 97 D PA 2022 Senator
Chuck Grassley 2500 1.67 5 0 0 R IA 2022 Senator
Markwayne Mullin 2500 2.00 6 0 0 R OK 2022 Senator
Chuck Schumer 2500 100.00 100 100 100 D NY 2022 Senator
Tina Smith 2500 100.00 100 100 100 D MN 2022 Senator
John Thune 2500 1.67 5 0 0 R SD 2022 Senator
Susan Collins 2000 46.00 54 51 33 R ME 2022 Senator
Todd Young 2000 6.33 19 0 0 R IN 2022 Senator
John Barrasso 1000 1.67 5 0 0 R WY 2022 Senator
Sherrod Brown 1000 100.00 100 100 100 D OH 2022 Senator
Cindy Hyde-Smith 1000 2.50 5 0 NA R MS 2022 Senator
Debbie Stabenow 1000 100.00 100 100 100 D MI 2022 Senator
paste("The total amount of money ASHA-PAC donated to Senators' 2022 winning campaigns:", sum(asha_2022_sen$ASHA_PAC_total), "dollars.")
## [1] "The total amount of money ASHA-PAC donated to Senators' 2022 winning campaigns: 43000 dollars."

Money by Most Recent HRC Rating

Splitting the score_117 into 0, 1-25, 26-50, 51-75, and 75-100 and see how much money is spent.

asha_2022_sen <- asha_2022_sen %>%
  mutate(groups_117 = case_when(
    score_117 == 0 ~ "0",
    score_117 <= 25 ~ "1-25",
    score_117 <= 50 ~ "26-50",
    score_117 <= 75 ~ "51-75",
    score_117 <= 100 ~ "76-100"
  ),
    groups_116 = case_when(
    score_116 == 0 ~ "0",
    score_116 <= 25 ~ "1-25",
    score_116 <= 50 ~ "26-50",
    score_116 <= 75 ~ "51-75",
    score_116 <= 100 ~ "76-100"))

asha_2022_sen %>% 
  group_by(groups_117) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/43000)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

ASHA-PAC donated:

  • $14,000 to campaigns given an HRC score of less than 25

  • $6,000 to campaigns given an HRC score between 51-75

  • $20,500 to campaigns given an HRC score above 75

Approximately a third of their donations went towards candidates with a score of less than 25.

Money by Average HRC Rating

Splitting the avg_score into 0, 1-25, 26-50, 51-75, and 75-100 and see how much money is spent.

asha_2022_sen <- asha_2022_sen %>%
  mutate(groups_avg = case_when(
    avg_score == 0 ~ "0",
    avg_score <= 25 ~ "1-25",
    avg_score <= 50 ~ "26-50",
    avg_score <= 75 ~ "51-75",
    avg_score <= 100 ~ "76-100"
  ))

asha_2022_sen %>% 
  group_by(groups_avg) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/43000)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

Based on Senators’ average score over the the most recent congressional sessions

ASHA-PAC donated:

  • $11,500 to campaigns given an HRC score of less than 25

  • $6,000 to campaigns given an HRC score between 26-50

  • $5,000 to campaigns given an HRC score between 51-75

  • $20,500 to campaigns given an HRC score above 75

Approximately 41% of their donations went to campaigns with an average record of an HRC equality score \(\leq\) 50.

Representatives

Representatives who won their race, their HRC scores, and the amount that ASHA-PAC has donated to their 2022 campaigns.

ashaPAC %>% select(name, party, state, ASHA_PAC_total, year, role) %>%
  filter(year == "2022", role == "Representative") %>%
  left_join(hrc_rep_df %>% 
              select(name,avg_score, score_117:score_115), by = "name") -> asha_2022_rep


asha_2022_rep %>%
  arrange(desc(ASHA_PAC_total)) %>%
  relocate(name, ASHA_PAC_total, avg_score:score_115)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ASHA_PAC_total avg_score score_117 score_116 score_115 party state year role
Frank Pallone Jr. 10000 98.67 96 100 100 D NJ 2022 Representative
Cathy McMorris Rodgers 10000 0.00 0 0 0 R WA 2022 Representative
Gus Bilirakis 5000 0.00 0 0 0 R FL 2022 Representative
Rodney Davis 5000 11.00 26 7 0 R IL 2022 Representative
David McKinley 5000 2.00 6 0 0 R WV 2022 Representative
Nancy Pelosi 5000 100.00 100 100 100 D CA 2022 Representative
Mikie Sherrill 5000 100.00 100 100 NA D NJ 2022 Representative
Mike Thompson 5000 100.00 100 100 100 D CA 2022 Representative
Brett Guthrie 4500 0.00 0 0 0 R KY 2022 Representative
Anna Eshoo 4000 99.33 98 100 100 D CA 2022 Representative
Suzanne Bonamici 3500 100.00 100 100 100 D OR 2022 Representative
Joseph Neguse 3500 100.00 100 100 NA D CO 2022 Representative
Lisa Blunt Rochester 3500 98.00 100 100 94 D DE 2022 Representative
Bill Johnson 3000 0.00 0 0 0 R OH 2022 Representative
Cindy Axne 2500 96.50 96 97 NA D IA 2022 Representative
Larry Bucshon 2500 0.00 0 0 0 R IN 2022 Representative
G K Butterfield 2500 87.33 92 88 82 D NC 2022 Representative
Angie Craig 2500 100.00 100 100 NA D MN 2022 Representative
Josh Harder 2500 97.00 94 100 NA D CA 2022 Representative
Doris Matsui 2500 100.00 100 100 100 D CA 2022 Representative
Lauren A Underwood 2500 98.50 100 97 NA D IL 2022 Representative
Alma Adams 1000 98.00 94 100 100 D NC 2022 Representative
Pete Aguilar 1000 100.00 100 100 100 D CA 2022 Representative
Kelly Armstrong 1000 4.00 8 0 NA R ND 2022 Representative
Troy Balderson 1000 6.50 6 7 NA R OH 2022 Representative
Karen Bass 1000 100.00 100 100 100 D CA 2022 Representative
Jaime Herrera Beutler 1000 11.00 10 8 15 R WA 2022 Representative
Earl Blumenauer 1000 100.00 100 100 100 D OR 2022 Representative
Brendan Boyle 1000 100.00 100 100 100 D PA 2022 Representative
Michael Burgess 1000 0.00 0 0 0 R TX 2022 Representative
Liz Cheney 1000 7.67 23 0 0 R WY 2022 Representative
Yvette D Clarke 1000 100.00 100 100 100 D NY 2022 Representative
Tom Cole 1000 8.33 18 7 0 R OK 2022 Representative
Joe Courtney 1000 100.00 100 100 100 D CT 2022 Representative
John Curtis 1000 2.67 8 0 0 R UT 2022 Representative
Diana DeGette 1000 100.00 100 100 100 D CO 2022 Representative
Suzan DelBene 1000 100.00 100 100 100 D WA 2022 Representative
Mark DeSaulnier 1000 100.00 100 100 100 D CA 2022 Representative
Debbie Dingell 1000 100.00 100 100 100 D MI 2022 Representative
Drew Ferguson 1000 0.00 0 0 0 R GA 2022 Representative
Jimmy Gomez 1000 100.00 100 100 100 D CA 2022 Representative
Kevin Hern 1000 0.00 0 0 NA R OK 2022 Representative
David Joyce 1000 17.00 26 7 18 R OH 2022 Representative
Robin Kelly 1000 100.00 100 100 100 D IL 2022 Representative
Dan Kildee 1000 100.00 100 100 100 D MI 2022 Representative
Derek Kilmer 1000 100.00 100 100 100 D WA 2022 Representative
Ann Kuster 1000 100.00 100 100 100 D NH 2022 Representative
Darin LaHood 1000 0.00 0 0 0 R IL 2022 Representative
Bob Latta 1000 0.00 0 0 0 R OH 2022 Representative
Lucy McBath 1000 100.00 100 100 NA D GA 2022 Representative
Chris Pappas 1000 100.00 100 100 NA D NH 2022 Representative
Mark Pocan 1000 100.00 100 100 100 D WI 2022 Representative
Jan Schakowsky 1000 100.00 100 100 100 D IL 2022 Representative
Bobby Scott 1000 96.00 94 97 97 D VA 2022 Representative
Terri A Sewell 1000 92.67 96 97 85 D AL 2022 Representative
Adrian Smith 1000 0.00 0 0 0 R NE 2022 Representative
Pete Stauber 1000 6.50 6 7 NA R MN 2022 Representative
Tim Walberg 1000 0.00 0 0 0 R MI 2022 Representative
Kevin Brady 0 0.67 2 0 0 R TX 2022 Representative
paste("The total amount of money ASHA-PAC donated to Representatives' 2022 Campaigns:", sum(asha_2022_rep$ASHA_PAC_total), "dollars.")
## [1] "The total amount of money ASHA-PAC donated to Representatives' 2022 Campaigns: 126500 dollars."

Money by Most Recent HRC Rating

Splitting the score_117 into 0, 1-25, 26-50, 51-75, and 75-100 and see how much money is spent.

asha_2022_rep <- asha_2022_rep %>%
  mutate(groups_117 = case_when(
    score_117 == 0 ~ "0",
    score_117 <= 25 ~ "1-25",
    score_117 <= 50 ~ "26-50",
    score_117 <= 75 ~ "51-75",
    score_117 <= 100 ~ "76-100"
  ),
    groups_116 = case_when(
    score_116 == 0 ~ "0",
    score_116 <= 25 ~ "1-25",
    score_116 <= 50 ~ "26-50",
    score_116 <= 75 ~ "51-75",
    score_116 <= 100 ~ "76-100"))

asha_2022_rep %>% 
  group_by(groups_117) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/126500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

ASHA-PAC donated:

  • $32,000 to campaigns given an HRC score of 0 (over 25% of the total money spent)

  • $12,000 to campaigns given an HRC score of less than 25

  • $6,000 to campaigns given an HRC score between 26-50

  • $76,500 to campaigns given an HRC score above 75

That’s $50,000 to campaigns with a score less than 50, or ~40% of their campaign donations.

# asha_2022_rep %>%
#   ggplot(aes(groups_117, ASHA_PAC_total)) + geom_bar(stat = "identity")


# asha_2022_rep %>%
#   ggplot(aes(groups_117, ASHA_PAC_total)) + 
#   geom_boxplot(width = .5, outlier.shape = NA) +
#   geom_jitter(width = .1, alpha = .5)+
#   theme_minimal() +
#   labs(x = "HRC Rating in 25pt intervals",
#        y = "Inidivudal Campaign Donations Amount ($)",
#        title = "ASHA-PAC's 2022 Representative Campaign Donations")+
#   theme(plot.title = element_text(hjust = .5))

Money by Average HRC Rating

Splitting the avg_score into 0, 1-25, 26-50, 51-75, and 75-100 and see how much money is spent.

asha_2022_rep <- asha_2022_rep %>%
  mutate(groups_avg = case_when(
    avg_score == 0 ~ "0",
    avg_score <= 25 ~ "1-25",
    avg_score <= 50 ~ "26-50",
    avg_score <= 75 ~ "51-75",
    avg_score <= 100 ~ "76-100"
  ))

asha_2022_rep %>% 
  group_by(groups_avg) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/126500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

Based on Representatives’ average score over the the most recent congressional sessions

ASHA-PAC donated:

  • $32,000 to campaigns given an HRC score of 0 (over 25% of the total money spent)

  • $18,000 to campaigns given an HRC score of less than 25

  • $76,500 to campaigns given an HRC score above 75

That’s 50,000 dollars to campaigns with an HRC equality score \(\leq\) 50, or ~40% of their campaign donations.

2020

Senators

Senators who won their race, their HRC scores, and the amount that ASHA-PAC donated to their 2020 campaigns.

ashaPAC %>% select(name, party, state, ASHA_PAC_total, year, role) %>%
  filter(year == "2020", role == "Senator") %>%
  left_join(hrc_sen_df %>% 
              select(name,avg_score, score_117:score_115), by = "name") -> asha_2020_sen

asha_2020_sen <- asha_2020_sen %>%
  mutate(score_116 = case_when(
    name == "Joe Kennedy III" ~ 100,
    TRUE ~ score_116),
    score_115 = case_when(
    name == "Joe Kennedy III" ~ 100,
    TRUE ~ score_115
    ),
    avg_score = case_when(
      name == "Joe Kennedy III" ~ 100,
      TRUE ~ avg_score
    ))

asha_2020_sen %>%
  arrange(desc(ASHA_PAC_total)) %>%
  relocate(name, ASHA_PAC_total, avg_score:score_115)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ASHA_PAC_total avg_score score_117 score_116 score_115 party state year role
Bill Cassidy 5000 4.00 12 0 0 R LA 2020 Senator
Susan Collins 3500 46.00 54 51 33 R ME 2020 Senator
Jeanne Shaheen 3500 100.00 100 100 100 D NH 2020 Senator
Dick Durbin 2500 100.00 100 100 100 D IL 2020 Senator
Cindy Hyde-Smith 2500 2.50 5 0 NA R MS 2020 Senator
Ben Luján 2500 100.00 100 NA NA D NM 2020 Senator
Mark Warner 2500 92.00 94 91 91 D VA 2020 Senator
Jeff Merkley 2000 100.00 100 100 100 D OR 2020 Senator
Shelley Moore Capito 1500 6.33 19 0 0 R WV 2020 Senator
Joe Kennedy III 1000 100.00 NA 100 100 D MA 2020 Senator
Tina Smith 1000 100.00 100 100 100 D MN 2020 Senator

Total $ Donated

paste("The total amount of money ASHA-PAC donated to Senators' 2020 Campaigns:", sum(asha_2020_sen$ASHA_PAC_total), "dollars.")
## [1] "The total amount of money ASHA-PAC donated to Senators' 2020 Campaigns: 27500 dollars."

Money by Most Recent HRC Rating

asha_2020_sen <- asha_2020_sen %>%
  mutate(groups_117 = case_when(
    score_117 == 0 ~ "0",
    score_117 <= 25 ~ "1-25",
    score_117 <= 50 ~ "26-50",
    score_117 <= 75 ~ "51-75",
    score_117 <= 100 ~ "76-100"
  ),
    groups_116 = case_when(
    score_116 == 0 ~ "0",
    score_116 <= 25 ~ "1-25",
    score_116 <= 50 ~ "26-50",
    score_116 <= 75 ~ "51-75",
    score_116 <= 100 ~ "76-100"))

asha_2020_sen %>% 
  group_by(groups_117) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/27500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

Based on Senators’ most recent HRC equality score

In 2020, ASHA-PAC donated:

  • $9,000 to campaigns given an HRC score less than 25

  • $3,500 to campaigns given an HRC score between 51-75

  • $14,000 to campaigns given an HRC score above 75

Approximately a third of their donations went towards candidates with a score of less than 25.

Money by Average HRC Rating

asha_2020_sen <- asha_2020_sen %>%
  mutate(groups_avg = case_when(
    avg_score == 0 ~ "0",
    avg_score <= 25 ~ "1-25",
    avg_score <= 50 ~ "26-50",
    avg_score <= 75 ~ "51-75",
    avg_score <= 100 ~ "76-100"
  ))

asha_2020_sen %>% 
  group_by(groups_avg) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/27500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

Based on Senators’ average HRC equality score

In 2020, ASHA-PAC donated:

  • $9,000 to campaigns given an HRC score less than 25

  • $3,500 to campaigns given an HRC score between 51-75

  • $15,000 to campaigns given an HRC score above 75

Approximately a third of their donations went towards candidates with an average score \(\leq\) 25.

Approximately 45% of their donations went towards candidates with an average score \(\leq\) 50.

Representatives

Representatives who won their race, their HRC scores, and the amount that ASHA-PAC donated to their 2020 campaigns.

ashaPAC %>% select(name, party, state, ASHA_PAC_total, year, role) %>%
  filter(year == "2020", role == "Representative") %>%
  left_join(hrc_rep_df %>% 
              select(name,avg_score, score_117:score_115), by = "name") -> asha_2020_rep

#asha_2020_rep %>% filter(is.na(score_116))


asha_2020_rep <- asha_2020_rep %>%
  mutate(
    score_116 = case_when(
      name == "Donna Shalala" ~ 100, #na for 115
      name == "Nita M Lowey" ~ 100, #100 for 115
      name == "Greg Walden" ~ 47, #0 for 115
      name == "Kendra Horn" ~ 88, #NA for 115
      name == "Anthony Brindisi" ~ 88, #NA for 115
      name == "George Holding" ~ 0, # 0 for 115
      #name == "John Lewis" ~
      name == "Pete Olson" ~ 7, #0 for 115
      name == "Tom Reed" ~ 47, #43 for 115
      name == "Steve Stivers" ~ 28, #0 for 115,
      TRUE ~ score_116
    ),
     score_115 = case_when(
     # name == "Donna Shalala" ~ 100, #na for 115
      name == "Nita M Lowey" ~ 100, #100 for 115
      name == "Greg Walden" ~ 0, #0 for 115
     # name == "Kendra Horn" ~ 88, #NA for 115
     # name == "Anthony Brindisi" ~ 88, #NA for 115
      name == "George Holding" ~ 0, # 0 for 115
      #name == "John Lewis" ~
      name == "Pete Olson" ~ 0, #0 for 115
      name == "Tom Reed" ~ 43, #43 for 115
      name == "Steve Stivers" ~ 0, #0 for 115,
      TRUE ~ score_115)
  )

#Need to recalculate the average scores since I manually added in the above scores

asha_2020_rep %>%
  select(name, score_117:score_115) %>% #keep only relevant info
  pivot_longer(score_117:score_115, names_to = "session", values_to = "score") %>%
  group_by(name) %>%
  summarise(name = name,
            avg_score = round(mean(score, na.rm = T),2)) %>%
  unique() %>%
  ungroup() %>%
  right_join(asha_2020_rep %>% select(-avg_score), by = "name") -> asha_2020_rep
asha_2020_rep %>%
  arrange(desc(ASHA_PAC_total)) %>%
  relocate(name, ASHA_PAC_total, avg_score, score_117:score_115)%>%
  kbl(table.attr = "style = \"color: black;\"") %>%
  kable_styling(bootstrap_options = c("striped", "hover"), position = "center") %>%
  scroll_box(height = "400px")
name ASHA_PAC_total avg_score score_117 score_116 score_115 party state year role
David McKinley 10000 2.00 6 0 0 R WV 2020 Representative
Frank Pallone Jr. 10000 98.67 96 100 100 D NJ 2020 Representative
Gus Bilirakis 10000 0.00 0 0 0 R FL 2020 Representative
Mike Thompson 10000 100.00 100 100 100 D CA 2020 Representative
Richard E Neal 10000 99.33 98 100 100 D MA 2020 Representative
Kevin Brady 7500 0.67 2 0 0 R TX 2020 Representative
Brett Guthrie 6000 0.00 0 0 0 R KY 2020 Representative
Cathy McMorris Rodgers 6000 0.00 0 0 0 R WA 2020 Representative
Anna Eshoo 5000 99.33 98 100 100 D CA 2020 Representative
Bobby L Rush 5000 98.67 96 100 100 D IL 2020 Representative
Bobby Scott 5000 96.00 94 97 97 D VA 2020 Representative
Doris Matsui 5000 100.00 100 100 100 D CA 2020 Representative
Glenn Thompson 5000 0.00 0 0 0 R PA 2020 Representative
Lloyd Doggett 5000 100.00 100 100 100 D TX 2020 Representative
Nancy Pelosi 5000 100.00 100 100 100 D CA 2020 Representative
Paul Tonko 5000 100.00 100 100 100 D NY 2020 Representative
Ron Kind 5000 99.33 98 100 100 D WI 2020 Representative
Virginia Foxx 5000 0.00 0 0 0 R NC 2020 Representative
Lisa Blunt Rochester 4500 98.00 100 100 94 D DE 2020 Representative
Donna Shalala 4000 100.00 NA 100 NA D FL 2020 Representative
Rosa DeLauro 4000 99.33 98 100 100 D CT 2020 Representative
Lauren A Underwood 3500 98.50 100 97 NA D IL 2020 Representative
Peter Welch 3500 100.00 100 100 100 D VT 2020 Representative
Suzanne Bonamici 3500 100.00 100 100 100 D OR 2020 Representative
Tim Walberg 3500 0.00 0 0 0 R MI 2020 Representative
Bill Johnson 3000 0.00 0 0 0 R OH 2020 Representative
Debbie Dingell 2500 100.00 100 100 100 D MI 2020 Representative
Diana DeGette 2500 100.00 100 100 100 D CO 2020 Representative
Earl Blumenauer 2500 100.00 100 100 100 D OR 2020 Representative
Elise Stefanik 2500 31.33 8 40 46 R NY 2020 Representative
Fred Upton 2500 38.33 58 42 15 R MI 2020 Representative
G K Butterfield 2500 87.33 92 88 82 D NC 2020 Representative
Greg Walden 2500 23.50 NA 47 0 R OR 2020 Representative
Kevin McCarthy 2500 0.00 0 0 0 R CA 2020 Representative
Michael Burgess 2500 0.00 0 0 0 R TX 2020 Representative
Nita M Lowey 2500 100.00 NA 100 100 D NY 2020 Representative
Robin Kelly 2500 100.00 100 100 100 D IL 2020 Representative
Steny H Hoyer 2500 99.00 100 100 97 D MD 2020 Representative
Steve Scalise 2500 0.00 0 0 0 R NA 2020 Representative
Tom Rice 2500 6.67 20 0 0 R SC 2020 Representative
Angie Craig 2000 100.00 100 100 NA D MN 2020 Representative
Cheri Bustos 2000 100.00 100 100 100 D IL 2020 Representative
David Joyce 2000 17.00 26 7 18 R OH 2020 Representative
Jan Schakowsky 2000 100.00 100 100 100 D IL 2020 Representative
Jason Smith 2000 0.00 0 0 0 R MO 2020 Representative
John Larson 2000 100.00 100 100 100 D CT 2020 Representative
Kendra Horn 2000 88.00 NA 88 NA D OK 2020 Representative
Kurt Schrader 2000 99.00 100 97 100 D OR 2020 Representative
Rodney Davis 2000 11.00 26 7 0 R IL 2020 Representative
Steven Horsford 1500 100.00 100 100 NA D NV 2020 Representative
Adrian Smith 1000 0.00 0 0 0 R NE 2020 Representative
Alma Adams 1000 98.00 94 100 100 D NC 2020 Representative
Ann Kuster 1000 100.00 100 100 100 D NH 2020 Representative
Anthony Brindisi 1000 88.00 NA 88 NA D NY 2020 Representative
Bill Pascrell Jr. 1000 100.00 100 100 100 D NJ 2020 Representative
Billy Long 1000 0.00 0 0 0 R MO 2020 Representative
Bob Latta 1000 0.00 0 0 0 R OH 2020 Representative
Brad Schneider 1000 100.00 100 100 100 D IL 2020 Representative
Brendan Boyle 1000 100.00 100 100 100 D PA 2020 Representative
Brian Fitzpatrick 1000 66.67 68 71 61 R PA 2020 Representative
Brian Higgins 1000 100.00 100 100 100 D NY 2020 Representative
Buddy Carter 1000 0.00 0 0 0 R GA 2020 Representative
Chris Pappas 1000 100.00 100 100 NA D NH 2020 Representative
Cindy Axne 1000 96.50 96 97 NA D IA 2020 Representative
Dan Kildee 1000 100.00 100 100 100 D MI 2020 Representative
Danny K Davis 1000 95.00 100 97 88 D IL 2020 Representative
Darin LaHood 1000 0.00 0 0 0 R IL 2020 Representative
Derek Kilmer 1000 100.00 100 100 100 D WA 2020 Representative
Donald McEachin 1000 100.00 100 100 100 D VA 2020 Representative
Drew Ferguson 1000 0.00 0 0 0 R GA 2020 Representative
Dwight Evans 1000 100.00 100 100 100 D PA 2020 Representative
French Hill 1000 0.00 0 0 0 R AR 2020 Representative
George Holding 1000 0.00 NA 0 0 R NC 2020 Representative
Hakeem Jeffries 1000 100.00 100 100 100 D NY 2020 Representative
Jahana Hayes 1000 100.00 100 100 NA D CT 2020 Representative
Jaime Herrera Beutler 1000 11.00 10 8 15 R WA 2020 Representative
James E Clyburn 1000 95.00 100 100 85 D SC 2020 Representative
Jared Huffman 1000 100.00 100 100 100 D CA 2020 Representative
Jimmy Gomez 1000 100.00 100 100 100 D CA 2020 Representative
Jimmy Panetta 1000 100.00 100 100 100 D CA 2020 Representative
Joe Courtney 1000 100.00 100 100 100 D CT 2020 Representative
John Lewis 1000 NaN NA NA NA D GA 2020 Representative
Joseph Neguse 1000 100.00 100 100 NA D CO 2020 Representative
Josh Harder 1000 97.00 94 100 NA D CA 2020 Representative
Judy Chu 1000 100.00 100 100 100 D CA 2020 Representative
Karen Bass 1000 100.00 100 100 100 D CA 2020 Representative
Katherine Clark 1000 100.00 100 100 100 D MA 2020 Representative
Kathy Castor 1000 98.00 94 100 100 D FL 2020 Representative
Kim Schrier 1000 100.00 100 100 NA D WA 2020 Representative
Linda Sánchez 1000 100.00 100 100 100 D CA 2020 Representative
Lucille Roybal-Allard 1000 100.00 100 100 100 D CA 2020 Representative
Lucy McBath 1000 100.00 100 100 NA D GA 2020 Representative
Mark DeSaulnier 1000 100.00 100 100 100 D CA 2020 Representative
Mark Pocan 1000 100.00 100 100 100 D WI 2020 Representative
Matt Cartwright 1000 100.00 100 100 100 D PA 2020 Representative
Mike Doyle 1000 100.00 100 100 100 D PA 2020 Representative
Mike Kelly 1000 0.00 0 0 0 R PA 2020 Representative
Nanette Barragán 1000 100.00 100 100 100 D CA 2020 Representative
Pete Olson 1000 3.50 NA 7 0 R TX 2020 Representative
Pete Stauber 1000 6.50 6 7 NA R MN 2020 Representative
Raul Ruiz 1000 100.00 100 100 100 D CA 2020 Representative
Steve Stivers 1000 14.00 NA 28 0 R OH 2020 Representative
Suzan DelBene 1000 100.00 100 100 100 D WA 2020 Representative
Terri A Sewell 1000 92.67 96 97 85 D AL 2020 Representative
Tom Cole 1000 8.33 18 7 0 R OK 2020 Representative
Tom O’Halleran 1000 99.00 100 97 100 D AZ 2020 Representative
Tom Reed 1000 45.00 NA 47 43 R NY 2020 Representative
Tom Suozzi 1000 100.00 100 100 100 D NY 2020 Representative
Tony Cárdenas 1000 99.33 98 100 100 D CA 2020 Representative
Troy Balderson 1000 6.50 6 7 NA R OH 2020 Representative
Vernon Buchanan 1000 4.33 6 7 0 R FL 2020 Representative
Yvette D Clarke 1000 100.00 100 100 100 D NY 2020 Representative

Total $ Donated

paste("The total amount of money ASHA-PAC donated to Representatives' 2020 Campaigns:", sum(asha_2020_rep$ASHA_PAC_total), "dollars.")
## [1] "The total amount of money ASHA-PAC donated to Representatives' 2020 Campaigns: 265500 dollars."

Money by Most Recent HRC Rating

asha_2020_rep <- asha_2020_rep %>%
  mutate(groups_117 = case_when(
    score_117 == 0 ~ "0",
    score_117 <= 25 ~ "1-25",
    score_117 <= 50 ~ "26-50",
    score_117 <= 75 ~ "51-75",
    score_117 <= 100 ~ "76-100"
  ),
  groups_116 = case_when(
    score_116 == 0 ~ "0",
    score_116 <= 25 ~ "1-25",
    score_116 <= 50 ~ "26-50",
    score_116 <= 75 ~ "51-75",
    score_116 <= 100 ~ "76-100"
  ))

asha_2020_rep %>% 
  group_by(groups_117) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/265500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

In 2020, ASHA-PAC donated:

  • $56,000 to campaigns given an HRC score of 0 (over 21% of the total money spent)

  • $27,500 to campaigns given an HRC score of less than 25

  • $4,000 to campaigns given an HRC score between 26-50

  • $3,500 to campaigns given an HRC score between 51-75

  • $157,500 to campaigns given an HRC score above 75

$87,500 or approximately 32.96% of their total campaign spending went towards campaigns with a score of less than 50 in 2020.

Money by Average HRC Rating

asha_2020_rep <- asha_2020_rep %>%
  mutate(groups_avg = case_when(
    avg_score == 0 ~ "0",
    avg_score <= 25 ~ "1-25",
    avg_score <= 50 ~ "26-50",
    avg_score <= 75 ~ "51-75",
    avg_score <= 100 ~ "76-100"
  ))

asha_2020_rep %>% 
  group_by(groups_avg) %>%
  summarise(n = n(), money_spent = sum(ASHA_PAC_total),
            percent_spent = round((money_spent/265500)*100,2)) %>%
  as_tibble() %>% rmarkdown::paged_table()

Based on Representatives’ average most recent HRC equality scores

In 2020, ASHA-PAC donated:

  • $57,000 to campaigns given an HRC score of 0 (over 21% of the total money spent)

  • $33,500 to campaigns given an HRC score of less than 25

  • $6,000 to campaigns given an HRC score between 26-50

  • $1,00 to campaigns given an HRC score between 51-75

  • $167,00 to campaigns given an HRC score above 75

96,500 or approximately 36.35% of their total campaign spending went towards campaigns with an average HRC equality score \(\leq\) 50 in 2020.

ASHA-PAC Spending over time

# ashaPAC has money spent and year, and role

#Make a separate df to examine spending over time, extracting only relevant information and aligning variables to graph the data

asha_2020_rep %>% 
  mutate(year_chamber = "2020 HoR",
         hrc_category = groups_116) %>%
  select(name, party, state, ASHA_PAC_total, year_chamber, hrc_category) -> over_time

asha_2020_sen%>% 
  mutate(year_chamber = "2020 Senate",
         hrc_category = groups_116) %>%
  select(name, party, state, ASHA_PAC_total, year_chamber, hrc_category) %>%
  bind_rows(over_time) -> over_time

asha_2022_rep%>% 
  mutate(year_chamber = "2022 HoR",
         hrc_category = groups_117) %>%
  select(name, party, state, ASHA_PAC_total, year_chamber, hrc_category) %>%
  bind_rows(over_time) -> over_time

asha_2022_sen%>% 
  mutate(year_chamber = "2022 Senate",
         hrc_category = groups_117) %>%
  select(name, party, state, ASHA_PAC_total, year_chamber, hrc_category) %>%
  bind_rows(over_time) -> over_time

Static Plot

set.seed(20)
#graph spending

over_time %>%
  filter(!is.na(hrc_category)) %>%
  ggplot(aes(year_chamber, ASHA_PAC_total, color = hrc_category)) + 
  geom_jitter(width = .2, 
              height = 200, 
              alpha = .8,
              size = 5)+
  theme_minimal() +
  theme(panel.background = element_rect(fill = "lightgray"))+
  labs(x = "Year & Chamber of Congress",
       y = "ASHA-PAC Campaign Contribution ($)") +
 # scale_color_discrete(name = "HRC Score") + 
  scale_color_brewer(palette = "YlOrRd", 
                     direction = -1,
                     name = "HRC Score")

Reactive Plot

set.seed(20)
#graph spending

p <- over_time %>%
  filter(!is.na(hrc_category)) %>%
  ggplot(aes(year_chamber, ASHA_PAC_total, color = hrc_category)) + 
  geom_jitter(width = .2, 
              height = 200, 
              alpha = .8,
              size = 5)+
  theme_minimal() +
  theme(panel.background = element_rect(fill = "lightgray"))+
  labs(x = "Year & Chamber of Congress",
       y = "ASHA-PAC Campaign Contribution ($)") +
 # scale_color_discrete(name = "HRC Score") + 
  scale_color_brewer(palette = "YlOrRd", 
                     direction = -1,
                     name = "HRC Score")

ggplotly(p)